Bug 1110922 - Add logs to debug test_played.html timeouts. r=cpearce
authorJW Wang <jwwang@mozilla.com>
Mon, 22 Dec 2014 23:12:00 -0500
changeset 221382 3d59a98d33c939f4ac6bdf24f1c5c976f1232586
parent 221381 a0315fb0c4f91e2611fd5f9993bba246ac8cc791
child 221383 c30c6cdaaa83aba93a04cb2ad6ef94ec4e7c26aa
push id28019
push userryanvm@gmail.com
push dateFri, 26 Dec 2014 19:40:56 +0000
treeherdermozilla-central@893064841be2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1110922
milestone37.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 1110922 - Add logs to debug test_played.html timeouts. r=cpearce
dom/media/test/test_played.html
--- a/dom/media/test/test_played.html
+++ b/dom/media/test/test_played.html
@@ -10,16 +10,17 @@
 <body>
 <pre id='test'>
 <script class="testbody" type='application/javascript;version=1.8'>
 //longer timeout for sometimes B2G emulator runs very slowly
 if (SpecialPowers.Services.appinfo.name == "B2G") {
   SimpleTest.requestLongerTimeout(3);
 }
 
+SimpleTest.requestCompleteLog();
 let manager = new MediaTestManager;
 
 function finish_test(element) {
   removeNodeAndSource(element);
   manager.finished(element.token);
 }
 
 // Check that a file has been played in its entirety.
@@ -74,16 +75,17 @@ var tests = [
 },
 
 // Play the first half of the file, seek back, while
 // continuing to play. We shall have only one range.
 {
   setup : function (element) {
     let onTimeUpdate = function() {
       if (element.currentTime > element.duration / 2) {
+        info(element.token + ": currentTime=" + element.currentTime + ", duration=" + element.duration);
         element.removeEventListener("timeupdate", onTimeUpdate, false);
         element.pause();
         var oldEndRange = element.played.end(0);
         element.currentTime = element.duration / 4;
         is(element.played.end(0), oldEndRange,
            element.token + ": When seeking back, |played| should not be changed");
         element.play();
       }
@@ -97,16 +99,17 @@ var tests = [
 
 // Play and seek to have two ranges, and check that, as well a
 // boundaries.
 {
   setup : function (element) {
     let seekTarget = 0;
     let onTimeUpdate = function() {
       if (element.currentTime > element.duration / 2) {
+        info(element.token + ": currentTime=" + element.currentTime + ", duration=" + element.duration);
         element.removeEventListener("timeupdate", onTimeUpdate, false);
         element.pause();
         // Remember seek target for later comparison since duration may change
         // during playback.
         seekTarget = element.currentTime = element.duration / 10;
         element.currentTime = seekTarget;
         element.play();
       }
@@ -218,16 +221,29 @@ function createTestArray() {
 function startTest(test, token) {
   var elemType = getMajorMimeType(test.type);
   var element = document.createElement(elemType);
   element.src = test.src;
   element.token = token;
   element.preload = "metadata";
   test.setup(element);
   manager.started(token);
+
+  // Log events for debugging.
+  var events = ["suspend", "play", "canplay", "canplaythrough", "loadstart", "loadedmetadata",
+                "loadeddata", "playing", "ended", "error", "stalled", "emptied", "abort",
+                "waiting", "pause"];
+  function logEvent(e) {
+    var v = e.target;
+    info(v.token + ": got " + e.type);
+  }
+  events.forEach(function(e) {
+    element.addEventListener(e, logEvent, false);
+  });
+
 }
 
 
 manager.runTests(createTestArray(), startTest);
 
 </script>
 </pre>
 </body>