Bug 1430173 Update tests for 2ms timers r?baku draft
authorTom Ritter <tom@mozilla.com>
Tue, 20 Feb 2018 15:36:16 -0600
changeset 760147 c2d3a749740c679268bb3a95a20d2e86b9439b2b
parent 760146 45dc916c551ca46c2cc82350437aebf281251f90
child 760148 6fe53be26472dfa163505e171919ffe127a39f99
push id100551
push userbmo:tom@mozilla.com
push dateMon, 26 Feb 2018 22:12:44 +0000
reviewersbaku
bugs1430173
milestone52.6.1
Bug 1430173 Update tests for 2ms timers r?baku MozReview-Commit-ID: 6xhQ71a5rDU
devtools/server/tests/mochitest/test_memory_allocations_05.html
docshell/test/chrome/test_bug453650.xul
dom/base/test/test_bug403852.html
dom/base/test/test_file_negative_date.html
dom/events/test/test_eventTimeStamp.html
dom/media/test/test_streams_element_capture.html
dom/media/test/test_streams_element_capture_createObjectURL.html
testing/web-platform/meta/media-source/mediasource-getvideoplaybackquality.html.ini
testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini
testing/web-platform/meta/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html.ini
testing/web-platform/meta/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini
toolkit/content/tests/widgets/test_videocontrols.html
old mode 100644
new mode 100755
--- a/devtools/server/tests/mochitest/test_memory_allocations_05.html
+++ b/devtools/server/tests/mochitest/test_memory_allocations_05.html
@@ -65,18 +65,19 @@ window.onload = function() {
     for (var i = 0; i < 3; i++) {
       var timestamp = response.allocationsTimestamps[allocatorIndices[i]];
       info("timestamp", timestamp);
       ok(timestamp, "We should have a timestamp for the `allocator` allocation.");
 
       if (lastTimestamp) {
         var delta = timestamp - lastTimestamp;
         info("delta since last timestamp", delta);
-        ok(delta >= 1 /* ms */,
-           "The timestamp should be about 1 ms after the last timestamp.");
+        // If we're unlucky, we might have rounded down to 0ms
+        // ok(delta >= 1 /* ms */,
+        //   "The timestamp should be about 1 ms after the last timestamp.");
       }
 
       lastTimestamp = timestamp;
     }
 
     yield memory.detach();
     destroyServerAndFinish(client);
   });
old mode 100644
new mode 100755
--- a/docshell/test/chrome/test_bug453650.xul
+++ b/docshell/test/chrome/test_bug453650.xul
@@ -56,29 +56,29 @@ https://bugzilla.mozilla.org/show_bug.cg
       reflow: function (start, end) {
         if (interruptible) {
           ok(false, "expected interruptible reflow");
         } else {
           ok(true, "observed uninterruptible reflow");
         }
 
         info("times: " + start + ", " + end);
-        ok(start < end, "reflow start time lower than end time");
+        ok(start <= end, "reflow start time lower than end time");
         done();
       },
 
       reflowInterruptible: function (start, end) {
         if (!interruptible) {
           ok(false, "expected uninterruptible reflow");
         } else {
           ok(true, "observed interruptible reflow");
         }
 
         info("times: " + start + ", " + end);
-        ok(start < end, "reflow start time lower than end time");
+        ok(start <= end, "reflow start time lower than end time");
         done();
       },
 
       QueryInterface: function (iid) {
         if (Ci.nsIReflowObserver.equals(iid) ||
             Ci.nsISupportsWeakReference.equals(iid) ||
             Ci.nsISupports.equals(iid))
           return this;
--- a/dom/base/test/test_bug403852.html
+++ b/dom/base/test/test_bug403852.html
@@ -33,33 +33,34 @@ function onOpened(message) {
   // Make sure the file is accessible with indexed notation
   var domFile = fileList.files[0];
 
   is(domFile.name, "prefs.js", "fileName should be prefs.js");
 
   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();
 
   // In our implementation of File object, lastModifiedDate is unknown only for new objects.
   // Using canvas or input[type=file] elements, we 'often' have a valid lastModifiedDate values.
   // For canvas we use memory files and the lastModifiedDate is now().
   var f = new File([new Blob(['test'], {type: 'text/plain'})], "test-name");
 
   var y = f.lastModifiedDate;
   var z = new Date();
 
   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();
 }
 
 </script>
 </pre>
 </body> </html>
--- a/dom/base/test/test_file_negative_date.html
+++ b/dom/base/test/test_file_negative_date.html
@@ -17,23 +17,23 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript;version=1.7">
 "use strict";
 
 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");
 
 </script>
 </pre>
 </body>
 </html>
 
--- a/dom/events/test/test_eventTimeStamp.html
+++ b/dom/events/test/test_eventTimeStamp.html
@@ -55,35 +55,36 @@ function testRegularEvents() {
   if (document.readyState === "complete") {
     ok(false, "Onload event has already fired");
     finishTests();
     return;
   }
   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();
   });
 }
 
 function testWorkerEvents() {
   var blob = new Blob([ document.getElementById("worker-src").textContent ],
                       { type: "text/javascript" });
   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();
   };
   var timeBeforeEvent = window.performance.now();
   worker.postMessage("");
 }
 
 function testSharedWorkerEvents() {
@@ -92,21 +93,22 @@ function testSharedWorkerEvents() {
              { type: "text/javascript" });
   // Delay creation of worker slightly so it is easier to distinguish
   // shared worker creation time from this document's navigation start
   window.setTimeout(function() {
     var timeBeforeWorkerCreation = window.performance.now();
     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();
     };
     worker.port.start();
     worker.port.postMessage("");
   }, 500);
 }
 
old mode 100644
new mode 100755
--- a/dom/media/test/test_streams_element_capture.html
+++ b/dom/media/test/test_streams_element_capture.html
@@ -33,17 +33,18 @@ function isGreaterThanOrEqualEps(a, b, m
 function startTest(test) {
   var v = document.createElement('video');
   var vout = document.createElement('video');
 
   v.src = test.name;
   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");
     }
     is(vout.readyState, vout.HAVE_CURRENT_DATA, test.name + " checking readyState");
     ok(vout.ended, test.name + " checking playback has ended");
     if (test.type.match(/^video/)) {
       checkDrawImage(vout);
old mode 100644
new mode 100755
--- a/dom/media/test/test_streams_element_capture_createObjectURL.html
+++ b/dom/media/test/test_streams_element_capture_createObjectURL.html
@@ -33,17 +33,18 @@ function startTest(test, token) {
   var vout = document.createElement('video');
   vout.token = token;
 
   v.src = test.name;
   v.preload = "metadata"
   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");
     }
     is(vout.readyState, vout.HAVE_CURRENT_DATA, test.name + " checking readyState");
     ok(vout.ended, test.name + " checking playback has ended");
     if (test.type.match(/^video/)) {
       checkDrawImage(vout);
old mode 100644
new mode 100755
--- a/testing/web-platform/meta/media-source/mediasource-getvideoplaybackquality.html.ini
+++ b/testing/web-platform/meta/media-source/mediasource-getvideoplaybackquality.html.ini
@@ -1,5 +1,7 @@
 [mediasource-getvideoplaybackquality.html]
   type: testharness
   [Test the totalFrameDelay attribute of HTMLVideoElement.getVideoPlaybackQuality() with MediaSource API]
     expected: FAIL
+  [Test HTMLVideoElement.getVideoPlaybackQuality() with MediaSource API]
+    disabled: Because we do timer rounding, sometimes the test passes, othertimes it fails
 
old mode 100644
new mode 100755
--- a/testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini
+++ b/testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini
@@ -1,5 +1,7 @@
 [performance-timeline.https.html]
   type: testharness
   [Resource Timing]
     expected: FAIL
+  [User Timing]
+    disabled: Because we do timer rounding, sometimes the test passes, othertimes it fails
 
new file mode 100755
--- /dev/null
+++ b/testing/web-platform/meta/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html.ini
@@ -0,0 +1,3 @@
+[retrospective-setValueAtTime.html]
+  [Test setValueAtTime with startTime in the past]
+    disabled: Because we do timer rounding, sometimes the test passes, othertimes it fails
new file mode 100755
--- /dev/null
+++ b/testing/web-platform/meta/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini
@@ -0,0 +1,3 @@
+[current-time-block-size.html]
+  [Test currentTime at completion of OfflineAudioContext rendering]
+    disabled: Because we do timer rounding, sometimes the test passes, othertimes it fails
--- a/toolkit/content/tests/widgets/test_videocontrols.html
+++ b/toolkit/content/tests/widgets/test_videocontrols.html
@@ -224,17 +224,17 @@ function runTest(event) {
 
     /*
      * Click the slider at the 1/4 point with the mouse (jump backwards)
      */
     case 13:
       is(event.type, "seeked", "checking event type");
       ok(true, "video position is at " + video.currentTime);
       var expectedTime = videoDuration / 2;
-      ok(Math.abs(video.currentTime - expectedTime) < 0.1, "checking expected playback position");
+      ok(Math.abs(video.currentTime - expectedTime) < 0.1, "checking expected playback position Math.abs(" + video.currentTime + " - " + expectedTime + ") < .1");
 
       SimpleTest.executeSoon(() => {
         synthesizeMouse(video, scrubberOffsetX + (scrubberWidth / 4), scrubberCenterY, { });
       });
       break;
 
     case 14:
       is(event.type, "seeking", "checking event type");