mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-04 06:17:30 +09:00
Bug 1430173 - Update tests for 2ms timers. r=baku, a=RyanVM
MozReview-Commit-ID: 6xhQ71a5rDU --HG-- extra : transplant_source : %C2%D3%A7It%0Cg%92h%BB%3A%95%A2%0D.%86%B9C%9B%2B
This commit is contained in:
parent
53a2f1007f
commit
ed176bb836
12 changed files with 41 additions and 25 deletions
|
|
@ -38,7 +38,8 @@ function onOpened(message) {
|
|||
ok("lastModifiedDate" in domFile, "lastModifiedDate must be present");
|
||||
|
||||
var d = new Date(message.mtime);
|
||||
is(d.getTime(), domFile.lastModifiedDate.getTime(), "lastModifiedDate should be the same");
|
||||
// Commented out: lastModifiedDate is rounded because it is a DOM API, message is a special-powers Chrome thing
|
||||
// is(d.getTime(), domFile.lastModifiedDate.getTime(), "lastModifiedDate should be the same");
|
||||
|
||||
var x = new Date();
|
||||
|
||||
|
|
@ -53,8 +54,8 @@ function onOpened(message) {
|
|||
ok((x.getTime() <= y.getTime()) && (y.getTime() <= z.getTime()), "lastModifiedDate of file which does not have last modified date should be current time");
|
||||
|
||||
|
||||
var d = new Date(message.fileDate);
|
||||
is(d.getTime(), message.fileWithDate.lastModifiedDate.getTime(), "lastModifiedDate should be the same when lastModified is set: " + message.fileWithDate.lastModified);
|
||||
// var d = new Date(message.fileDate);
|
||||
// is(d.getTime(), message.fileWithDate.lastModifiedDate.getTime(), "lastModifiedDate should be the same when lastModified is set: " + message.fileWithDate.lastModified);
|
||||
|
||||
script.destroy();
|
||||
SimpleTest.finish();
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1158437
|
|||
|
||||
var blob = new Blob(['hello world']);
|
||||
var f1 = new File([blob], 'f1.txt', { lastModified: 0 });
|
||||
var f2 = new File([blob], 'f2.txt', { lastModified: -1 });
|
||||
var f2 = new File([blob], 'f2.txt', { lastModified: -2 });
|
||||
var f3 = new File([blob], 'f3.txt', { lastModified: -1000 });
|
||||
|
||||
is(f1.lastModified, 0, "lastModified == 0 is supported");
|
||||
ok(f1.lastModifiedDate.toString(), (new Date(0)).toString(), "Correct f1.lastModifiedDate value");
|
||||
is(f2.lastModified, -1, "lastModified == -1 is supported");
|
||||
ok(f2.lastModifiedDate.toString(), (new Date(-1)).toString(), "Correct f2.lastModifiedDate value");
|
||||
is(f2.lastModified, -2, "lastModified == -2 is supported");
|
||||
ok(f2.lastModifiedDate.toString(), (new Date(-2)).toString(), "Correct f2.lastModifiedDate value");
|
||||
is(f3.lastModified, -1000, "lastModified == -1000 is supported");
|
||||
ok(f3.lastModifiedDate.toString(), (new Date(-1000)).toString(), "Correct f3.lastModifiedDate value");
|
||||
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ function testRegularEvents() {
|
|||
var timeBeforeEvent = window.performance.now();
|
||||
window.addEventListener("load", function(evt) {
|
||||
var timeAfterEvent = window.performance.now();
|
||||
ok(evt.timeStamp > timeBeforeEvent &&
|
||||
evt.timeStamp < timeAfterEvent,
|
||||
ok(evt.timeStamp >= timeBeforeEvent &&
|
||||
evt.timeStamp <= timeAfterEvent,
|
||||
"Event timestamp (" + evt.timeStamp + ") is in expected range: (" +
|
||||
timeBeforeEvent + ", " + timeAfterEvent + ")");
|
||||
testWorkerEvents();
|
||||
|
|
@ -74,11 +74,12 @@ function testWorkerEvents() {
|
|||
var worker = new Worker(window.URL.createObjectURL(blob));
|
||||
worker.onmessage = function(evt) {
|
||||
var timeAfterEvent = window.performance.now();
|
||||
ok(evt.data > timeBeforeEvent &&
|
||||
evt.data < timeAfterEvent,
|
||||
"Event timestamp in dedicated worker (" + evt.data +
|
||||
") is in expected range: (" +
|
||||
timeBeforeEvent + ", " + timeAfterEvent + ")");
|
||||
// Comparing times across timelines may break now
|
||||
// ok(evt.data >= timeBeforeEvent &&
|
||||
// evt.data <= timeAfterEvent,
|
||||
// "Event timestamp in dedicated worker (" + evt.data +
|
||||
// ") is in expected range: (" +
|
||||
// timeBeforeEvent + ", " + timeAfterEvent + ")");
|
||||
worker.terminate();
|
||||
testSharedWorkerEvents();
|
||||
};
|
||||
|
|
@ -97,11 +98,12 @@ function testSharedWorkerEvents() {
|
|||
var worker = new SharedWorker(window.URL.createObjectURL(blob));
|
||||
worker.port.onmessage = function(evt) {
|
||||
var timeAfterEvent = window.performance.now();
|
||||
ok(evt.data > 0 &&
|
||||
evt.data < timeAfterEvent - timeBeforeWorkerCreation,
|
||||
"Event timestamp in shared worker (" + evt.data +
|
||||
") is in expected range: (0, " +
|
||||
(timeAfterEvent - timeBeforeWorkerCreation) + ")");
|
||||
// Comparing times across timelines may break now
|
||||
// ok(evt.data >= 0 &&
|
||||
// evt.data <= timeAfterEvent - timeBeforeWorkerCreation,
|
||||
// "Event timestamp in shared worker (" + evt.data +
|
||||
// ") is in expected range: (0, " +
|
||||
// (timeAfterEvent - timeBeforeWorkerCreation) + ")");
|
||||
worker.port.close();
|
||||
finishTests();
|
||||
};
|
||||
|
|
|
|||
3
dom/media/test/test_streams_element_capture.html
Normal file → Executable file
3
dom/media/test/test_streams_element_capture.html
Normal file → Executable file
|
|
@ -38,7 +38,8 @@ function startTest(test) {
|
|||
var stream;
|
||||
|
||||
var checkEnded = function() {
|
||||
is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime");
|
||||
// We know the video time won't match up to the stream time
|
||||
// is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime");
|
||||
if (test.duration) {
|
||||
isGreaterThanOrEqualEps(vout.currentTime, test.duration,
|
||||
test.name + " current time at end");
|
||||
|
|
|
|||
3
dom/media/test/test_streams_element_capture_createObjectURL.html
Normal file → Executable file
3
dom/media/test/test_streams_element_capture_createObjectURL.html
Normal file → Executable file
|
|
@ -38,7 +38,8 @@ function startTest(test, token) {
|
|||
var stream;
|
||||
|
||||
var checkEnded = function() {
|
||||
is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime");
|
||||
// We know the video time won't match up to the stream time
|
||||
// is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime");
|
||||
if (test.duration) {
|
||||
isGreaterThanOrEqualEps(vout.currentTime, test.duration,
|
||||
test.name + " current time at end");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue