Bug 1080685 - Add more debug aids and longer timeout. r=edwin, a=test-only
authorJW Wang <jwwang@mozilla.com>
Tue, 14 Apr 2015 13:11:23 +0800
changeset 258463 b2d1be38dab1
parent 258462 bf3ca76f10c3
child 258464 d1e3ce033c7a
push id4676
push userryanvm@gmail.com
push date2015-04-15 02:06 +0000
treeherdermozilla-beta@91df81e2edac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin, test-only
bugs1080685
milestone38.0
Bug 1080685 - Add more debug aids and longer timeout. r=edwin, a=test-only
dom/media/test/manifest.js
dom/media/test/test_playback.html
--- a/dom/media/test/manifest.js
+++ b/dom/media/test/manifest.js
@@ -106,16 +106,20 @@ var gMediaRecorderTests = [
   { name:"detodos.opus", type:"audio/ogg; codecs=opus", duration:2.9135 }
 ];
 
 // These are files that we want to make sure we can play through.  We can
 // also check metadata.  Put files of the same type together in this list so if
 // something crashes we have some idea of which backend is responsible.
 // Used by test_playback, which expects no error event and one ended event.
 var gPlayTests = [
+  // Test playback of a WebM file with vp9 video
+  //{ name:"vp9.webm", type:"video/webm", duration:4 },
+  { name:"vp9cake.webm", type:"video/webm", duration:7.966 },
+
   // 8-bit samples
   { name:"r11025_u8_c1.wav", type:"audio/x-wav", duration:1.0 },
   // 8-bit samples, file is truncated
   { name:"r11025_u8_c1_trunc.wav", type:"audio/x-wav", duration:1.8 },
   // file has trailing non-PCM data
   { name:"r11025_s16_c1_trailing.wav", type:"audio/x-wav", duration:1.0 },
   // file with list chunk
   { name:"r16000_u8_c1_list.wav", type:"audio/x-wav", duration:4.2 },
@@ -220,20 +224,16 @@ var gPlayTests = [
   // A truncated VBR MP3 with just enough frames to keep most decoders happy.
   // The Xing header reports the length of the file to be around 10 seconds, but
   // there is really only one second worth of data. We want MP3FrameParser to
   // trust the header, so this should be reported as 10 seconds.
   { name:"vbr-head.mp3", type:"audio/mpeg", duration:10.00 },
 
   // Invalid file
   { name:"bogus.duh", type:"bogus/duh", duration:Number.NaN },
-
-  // Test playback of a WebM file with vp9 video
-  //{ name:"vp9.webm", type:"video/webm", duration:4 },
-  { name:"vp9cake.webm", type:"video/webm", duration:7.966 }
 ];
 
 // A file for each type we can support.
 var gSnifferTests = [
   { name:"big.wav", type:"audio/x-wav", duration:9.278981, size:102444 },
   { name:"320x240.ogv", type:"video/ogg", width:320, height:240, duration:0.233, size:28942 },
   { name:"seek.webm", type:"video/webm", duration:3.966, size:215529 },
   { name:"gizmo.mp4", type:"video/mp4", duration:5.56, size:383631 },
--- a/dom/media/test/test_playback.html
+++ b/dom/media/test/test_playback.html
@@ -5,19 +5,25 @@
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   <script type="text/javascript" src="manifest.js"></script>
 </head>
 <body>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
-//longer timeout for sometimes B2G emulator runs very slowly
-if (SpecialPowers.Services.appinfo.name == "B2G") {
+function isSlowPlatform() {
+  return SpecialPowers.Services.appinfo.name == "B2G" ||
+         navigator.userAgent.indexOf("Mobile") != -1 && androidVersion == 10;
+}
+
+// longer timeout for slow platforms
+if (isSlowPlatform()) {
   SimpleTest.requestLongerTimeout(3);
+  SimpleTest.requestCompleteLog();
 }
 
 var manager = new MediaTestManager;
 
 function startTest(test, token) {
   var v = document.createElement('video');
   v.preload = "metadata";
   v.token = token;
@@ -112,24 +118,24 @@ function startTest(test, token) {
 
   // We should get "ended" and "suspend" events for every resource
   v.addEventListener("ended", checkEnded, false);
   v.addEventListener("suspend", checkSuspended, false);
 
   document.body.appendChild(v);
   v.play();
 
-  if (test.name == "vp9cake.webm") {
-    // Log events for debugging.
+  // Debug timeouts on slow platforms.
+  if (isSlowPlatform()) {
     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(e.target.token + ": got " + e.type);
+      Log(e.target.token, "got " + e.type);
     }
     events.forEach(function(e) {
       v.addEventListener(e, logEvent, false);
     });
   }
 }
 
 manager.runTests(gPlayTests, startTest);