Bug 1237607 - Add file names to logs of test_playback_rate.html to facilitate debugging. r=bechen.
authorJW Wang <jwwang@mozilla.com>
Fri, 08 Jan 2016 15:52:25 +0800
changeset 279083 2ee573ab8547d536bd79d2b6e43e2e5efe2f2015
parent 279082 edf79b699755aaa8f0da7850ff0b2cccd9135c4e
child 279084 cc04ff0cdededd04de5ccefc35c98565ddf94f90
push id69976
push userjwwang@mozilla.com
push dateFri, 08 Jan 2016 07:54:05 +0000
treeherdermozilla-inbound@2ee573ab8547 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbechen
bugs1237607
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1237607 - Add file names to logs of test_playback_rate.html to facilitate debugging. r=bechen.
dom/media/test/test_playback_rate.html
--- a/dom/media/test/test_playback_rate.html
+++ b/dom/media/test/test_playback_rate.html
@@ -43,23 +43,22 @@ function ontimeupdate(e) {
   t.testedForSlowdown = true;
   if (t.currentTime > t.duration / 2) {
     t.oldCurrentTime = t.currentTime;
     t.timestamp = Date.now();
     var delta = t.oldCurrentTime,
         delta_wallclock = (t.timestamp - t.startTimestamp - t.bufferingTime) / 1000;
 
     t.mozPreservesPitch = false;
-    is(t.mozPreservesPitch, false, "If we disable the pitch preservation, it should appear as such.");
+    is(t.mozPreservesPitch, false, t.name + ": If we disable the pitch preservation, it should appear as such.");
 
     t.bufferingTime = 0;
 
-    is(t.playbackRate, SLOW_RATE,
-        "The playback rate shoud be "+SLOW_RATE+"." + t.token);
-    ok(checkPlaybackRate(delta_wallclock, delta, SLOW_RATE, 0.25), "We are effectively slowing down playback. (" + delta_wallclock + ", " + delta + ") for " + t.token);
+    is(t.playbackRate, SLOW_RATE, t.name + ": The playback rate shoud be "+SLOW_RATE+".");
+    ok(checkPlaybackRate(delta_wallclock, delta, SLOW_RATE, 0.25), t.name + ": We are effectively slowing down playback. (" + delta_wallclock + ", " + delta + ")");
     t.removeEventListener("timeupdate", ontimeupdate);
     t.addEventListener("pause", onpaused);
     t.playbackRate = NULL_RATE;
     t.oldCurrentTime = t.currentTime;
     setTimeout(function() {
       afterNullPlaybackRate(e);
     }, 100);
   }
@@ -75,36 +74,36 @@ function afterNullPlaybackRate(e) {
 
   // skip if we have received 'ended' event or 'ended' event is pending.
   if (t.gotEnded || t.ended) {
     return;
   }
 
   t.testedForNull = true;
 
-  ok(t.currentTime == t.oldCurrentTime, "Current time should not change when playbackRate is null (" + t.currentTime + " " + t.oldCurrentTime + ").");
-  ok(!t.paused, "The element should not be in paused state.");
+  ok(t.currentTime == t.oldCurrentTime, t.name + ": Current time should not change when playbackRate is null (" + t.currentTime + " " + t.oldCurrentTime + ").");
+  ok(!t.paused, t.name + ": The element should not be in paused state.");
   t.removeEventListener("paused", onpaused);
-  is(t.pausedReceived, undefined, "Paused event should not have been received.");
+  is(t.pausedReceived, undefined, t.name + ": Paused event should not have been received.");
   t.timestamp = Date.now();
   t.oldCurrentTime = t.currentTime;
   t.playbackRate = VERY_FAST_RATE;
-  is(t.playbackRate, FAST_RATE, "Playback rate should be clamped to " + FAST_RATE + ".");
+  is(t.playbackRate, FAST_RATE, t.name + ": Playback rate should be clamped to " + FAST_RATE + ".");
 }
 
 function onended(e) {
   var t = e.target;
   t.gotEnded = true;
 
   t.bufferingTime = 0;
   // If we got "ended" too early, skip these tests.
   if (t.testedForSlowdown && t.testedForNull) {
-    is(t.playbackRate, FAST_RATE, "The playback rate should still be "+FAST_RATE+".");
-    ok(!t.muted, "The audio should be muted when playing at high speed, but should not appear as such.");
-    is(t.currentTime, t.duration, "Current time should be equal to the duration (not change by playback rate).");
+    is(t.playbackRate, FAST_RATE, t.name + ": The playback rate should still be "+FAST_RATE+".");
+    ok(!t.muted, t.name + ": The audio should be muted when playing at high speed, but should not appear as such.");
+    is(t.currentTime, t.duration, t.name + ": Current time should be equal to the duration (not change by playback rate).");
   }
   finish_test(t);
 }
 
 function onratechange(e) {
   if (!e.target.ratechangecount) {
     e.target.ratechangecount = 0;
   }
@@ -129,42 +128,43 @@ function onplaying(e) {
 }
 
 function onwaiting(e) {
   var t = e.target;
   t.bufferingTimestamp = Date.now();
 }
 
 function onvolumechange(e) {
-  ok(false, "We should not receive a volumechange event when changing the playback rate.");
+  ok(false, e.target.name + ": We should not receive a volumechange event when changing the playback rate.");
 }
 
 function startTest(test, token) {
   let elemType = /^audio/.test(test.type) ? "audio" : "video";
   let element = document.createElement(elemType);
   element.src = test.name;
+  element.name = test.name;
   element.preload = "metadata";
   element.token = token;
   element.controls = true;
   element.bufferingTime = 0;
   document.body.appendChild(element);
   element.addEventListener("ratechange", onratechange);
   element.addEventListener("timeupdate", ontimeupdate);
   element.addEventListener("ended", onended);
   element.addEventListener("waiting", onwaiting);
   element.addEventListener("playing", onplaying);
   element.addEventListener("volumechange", onvolumechange);
   manager.started(token);
   element.startTimestamp = Date.now();
-  is(element.mozPreservesPitch, true, "Pitch preservation should be enabled by default.");
+  is(element.mozPreservesPitch, true, test.name + ": Pitch preservation should be enabled by default.");
   element.addEventListener("loadedmetadata", function() {
-    is(element.playbackRate, 1.0, "playbackRate should be initially 1.0");
-    is(element.defaultPlaybackRate, 1.0, "defaultPlaybackRate should be initially 1.0");
+    is(element.playbackRate, 1.0, test.name + ": playbackRate should be initially 1.0");
+    is(element.defaultPlaybackRate, 1.0, test.name + ": defaultPlaybackRate should be initially 1.0");
     element.playbackRate = VERY_SLOW_RATE;
-    is(element.playbackRate, SLOW_RATE, "PlaybackRate should be clamped to " + SLOW_RATE + ".");
+    is(element.playbackRate, SLOW_RATE, test.name + ": PlaybackRate should be clamped to " + SLOW_RATE + ".");
     element.play();
     element.playbackRate = SLOW_RATE;
   });
 }
 
 manager.runTests(gPlayedTests, startTest);
 
 </script>