Bug 1080685 - add more debug aids and longer timeout. r=edwin.
--- a/dom/media/test/manifest.js
+++ b/dom/media/test/manifest.js
@@ -107,16 +107,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 },
@@ -221,20 +225,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);