Bug 1311231 - Fix test_mixed_principals.html in XP. r?jwwang
Can not play mp4 on XP. So add the canPlayType checking for the test failure.
MozReview-Commit-ID: KH70XsQkYYF
--- a/dom/media/test/mochitest.ini
+++ b/dom/media/test/mochitest.ini
@@ -792,17 +792,16 @@ tags=msg capturestream
[test_mediatrack_consuming_mediastream.html]
tags=msg
[test_mediatrack_events.html]
skip-if = toolkit == 'gonk' && debug # bug 1065924
[test_mediatrack_parsing_ogg.html]
[test_mediatrack_replay_from_end.html]
[test_metadata.html]
[test_mixed_principals.html]
-skip-if = os == 'win' && os_version == '5.1' # Skip XP. See bug Bug 1311231
[test_mozHasAudio.html]
[test_multiple_mediastreamtracks.html]
[test_networkState.html]
[test_new_audio.html]
[test_no_load_event.html]
[test_paused.html]
[test_paused_after_ended.html]
[test_play_events.html]
--- a/dom/media/test/test_mixed_principals.html
+++ b/dom/media/test/test_mixed_principals.html
@@ -17,17 +17,16 @@ https://bugzilla.mozilla.org/show_bug.cg
<video id="v1" preload="metadata" onended="onendedcb('v1')"></video>
<video id="v2" preload="metadata" onended="onendedcb('v2')"></video>
<pre id="test">
<script type="text/javascript">
SimpleTest.waitForExplicitFinish();
var pushPrefs = (...p) => new Promise(r => SpecialPowers.pushPrefEnv({set: p}, r));
-var throwOutside = e => setTimeout(() => { throw e; });
var v1 = document.getElementById("v1");
var v2 = document.getElementById("v2");
var count = 0;
function onendedcb(id) {
var c = document.createElement("canvas");
var ctx = c.getContext("2d");
@@ -40,18 +39,20 @@ function onendedcb(id) {
ok(true, "Threw exception in toDataURL for " + id);
}
if (++count == 2) {
SimpleTest.finish();
}
}
function testMixedPrincipals(resource) {
- if (!resource) {
+ // In some OS(XP) can not play mp4. Add this checking for the test failure.
+ if (!resource || !v1.canPlayType(resource.type)) {
todo(false, "No types supported");
+ SimpleTest.finish();
return;
}
// Make sure the media cache size(50MB) is large enough that the data could
// be download in MediaCache completely.
return pushPrefs(['media.cache_size', 50*1024])
.then(() => {
// Generate a random key. The first load with that key will return
@@ -79,16 +80,15 @@ function testMixedPrincipals(resource) {
v2.src = "http://example.org/tests/dom/media/test/dynamic_redirect.sjs?key=v2_" + key + "&res=" + resource.name;
v2.onloadeddata = function () {
// To limit readahead, avoid racing with playback and "catching up" mode.
v2.play();
}
});
}
-testMixedPrincipals({ name:"pixel_aspect_ratio.mp4", type:"video/mp4", duration:28})
-.catch(e => throwOutside(e));
+testMixedPrincipals({ name:"pixel_aspect_ratio.mp4", type:"video/mp4", duration:28});
</script>
</pre>
</body>
</html>