Bug 898696 - Fix some content/media test files by adding preload=metadata to media element. r=cpearce

This commit is contained in:
Martijn Wargers 2013-07-31 09:35:44 +02:00
parent a44fdce7fd
commit 7f63b0ec1a
29 changed files with 40 additions and 96 deletions

View File

@ -37,6 +37,7 @@ function goToNext(v) {
function initTest(test, token) {
var v = document.createElement('video');
v.preload = "metadata";
v.token = token;
manager.started(token);
v._state = 0;

View File

@ -72,6 +72,7 @@ function ended(e) {
function startTest(test, token) {
var v = document.createElement('video');
v.preload = "metadata";
v.token = token;
manager.started(token);

View File

@ -45,6 +45,7 @@ function stopped(event) {
function startTest(test, token) {
var v = document.createElement('video');
v.preload = "metadata";
v.token = token;
manager.started(token);
v.src = test.name;

View File

@ -45,10 +45,10 @@ function onMetaData(id) {
]]>
</script>
<video id='a1' onloadedmetadata="onMetaData('a1');"><sauce/><source type="bad" src="404" onerror="onError(event, 'a1');"/></video>
<video id='a2' onloadedmetadata="onMetaData('a2');"><source onerror="onError(event, 'a2');"/></video>
<video id='a3' onloadedmetadata="onMetaData('a3');"><html:source onerror="onError(event, 'a3');"/></video>
<video id='a4' onloadedmetadata="onMetaData('a4');"><svg:source/><source onerror="onError(event, 'a4');" type="bad" src="404"/></video>
<video id="a1" preload="metadata" onloadedmetadata="onMetaData('a1');"><sauce/><source type="bad" src="404" onerror="onError(event, 'a1');"/></video>
<video id="a2" preload="metadata" onloadedmetadata="onMetaData('a2');"><source onerror="onError(event, 'a2');"/></video>
<video id="a3" preload="metadata" onloadedmetadata="onMetaData('a3');"><html:source onerror="onError(event, 'a3');"/></video>
<video id="a4" preload="metadata" onloadedmetadata="onMetaData('a4');"><svg:source/><source onerror="onError(event, 'a4');" type="bad" src="404"/></video>
<script class="testbody" type="text/javascript">
<![CDATA[

View File

@ -47,6 +47,7 @@ function initTest(test, token) {
var v = document.createElement(type);
if (!v.canPlayType(test.type))
return;
v.preload = "metadata";
v.token = token;
manager.started(token);
v._name = test.name;

View File

@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=686137
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=686137">Mozilla Bug 686137</a>
<audio id='a1' controls muted></audio>
<audio id="a1" controls muted preload="metadata"></audio>
<pre id="test">
<script class="testbody" type="text/javascript">

View File

@ -24,6 +24,7 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
preload="metadata"
src='contentDuration1.sjs'
onloadedmetadata='on_metadataloaded();'></video>
</body>

View File

@ -24,6 +24,7 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
preload="metadata"
src='contentDuration2.sjs'
onloadedmetadata='on_metadataloaded();'></video>
</body>

View File

@ -24,6 +24,7 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
preload="metadata"
src='contentDuration3.sjs'
onloadedmetadata='on_metadataloaded();'></video>
</body>

View File

@ -24,6 +24,7 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
preload="metadata"
src='contentDuration4.sjs'
onloadedmetadata='on_metadataloaded();'></video>
</body>

View File

@ -24,6 +24,7 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
preload="metadata"
src='contentDuration5.sjs'
onloadedmetadata='on_metadataloaded();'></video>
</body>

View File

@ -24,6 +24,7 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
preload="metadata"
src='contentDuration6.sjs'
onloadedmetadata='on_metadataloaded();'></video>
</body>

View File

@ -25,6 +25,7 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
preload="metadata"
src='contentDuration7.sjs'
onloadedmetadata='on_metadataloaded();'></video>
</body>

View File

@ -11,8 +11,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=448600
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=448600">Mozilla Bug 448600</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
@ -25,16 +24,6 @@ function e(id) {
return document.getElementById(id);
}
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
var branch = prefService.getBranch("media.");
var gOldOggPref = branch.getBoolPref("ogg.enabled");
var gOldWavePref = branch.getBoolPref("wave.enabled");
branch.setBoolPref("ogg.enabled", false);
branch.setBoolPref("wave.enabled", false);
var gLoadError = new Object();
gLoadError['video1'] = 0;
@ -59,11 +48,6 @@ function finishTest() {
is(gLoadError['video1'], 2, "Expect one error per invalid source child on video1");
is(gLoadError['video2'], 1, "Expect one error on video2");
is(gLoadError['video3'], 1, "Expect one error on video3");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
branch.setBoolPref("ogg.enabled", gOldOggPref);
branch.setBoolPref("wave.enabled", gOldWavePref);
SimpleTest.finish();
}
@ -78,13 +62,15 @@ function videoError(event, id) {
</script>
<!-- We make the resource URIs unique to ensure that they are (re)loaded with the new disable-decoder prefs. -->
<video id="video1">
<source type="video/ogg" src="320x240.ogv?decoder_disabled=1" onerror="videoError(event, 'video1');"/>
<source type="audio/wave" src="r11025_u8_c1.wav?decoder_disabled=1" id='s2' onerror="videoError(event, 'video1');"/>
</video>
<div id="content">
</div>
<script>
function makeVideos() {
document.getElementById('content').innerHTML = '<video id="video1" preload="metadata"><source type="video/ogg" src="320x240.ogv?decoder_disabled=1" onerror="videoError(event, \'video1\');"/><source type="audio/wave" src="r11025_u8_c1.wav?decoder_disabled=1" id=\'s2\' onerror="videoError(event, \'video1\');"/></video><video id="video2" preload="metadata" src="320x240.ogv?decoder_disabled=2" onerror="videoError(event, \'video2\');"></video><video id="video3" preload="metadata" src="r11025_u8_c1.wav?decoder_disabled=2" onerror="videoError(event, \'video3\');"></video>';
}
<video id="video2" src="320x240.ogv?decoder_disabled=2" onerror="videoError(event, 'video2');"></video>
<video id="video3" src="r11025_u8_c1.wav?decoder_disabled=2" onerror="videoError(event, 'video3');"></video>
SpecialPowers.pushPrefEnv({"set": [["media.ogg.enabled", false], ["media.wave.enabled", false]]}, makeVideos);
</script>
</pre>

View File

@ -101,6 +101,7 @@ function createTestArray() {
function startTest(test, token) {
var v = document.createElement('video');
manager.started(token);
v.preload = "metadata";
v.src = test.name;
v.token = token;
v.controls = true;

View File

@ -65,6 +65,7 @@ function startTest(test, token) {
}
var v = document.createElement('video');
manager.started(token);
v.preload = "metadata";
v.src = test.name;
v.token = token;
v.controls = true;

View File

@ -13,7 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=490705
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=490705">Mozilla Bug 490705</a>
<!-- mute audio, since there is no need to hear the sound for these tests -->
<audio id='a1' controls></audio>
<audio id="a1" preload="metadata" controls></audio>
<pre id="test">
<script class="testbody" type="text/javascript">

View File

@ -14,6 +14,7 @@ var manager = new MediaTestManager;
function maketest(attach_media, name, type, check_metadata) {
return function (token) {
var e = document.createElement('video');
e.preload = "metadata";
manager.started(token);
var errorRun = false;
if (check_metadata) {

View File

@ -14,6 +14,7 @@ var manager = new MediaTestManager;
function startTest(test, token) {
var v = document.createElement('video');
v.preload = "metadata";
v.token = token;
manager.started(token);
v.src = test.name;

View File

@ -14,6 +14,7 @@ var manager = new MediaTestManager;
function startTest(test, token) {
var v = document.createElement('video');
v.preload = "metadata";
v.token = token;
manager.started(token);

View File

@ -155,6 +155,7 @@ function startTest(test, token) {
let elemType = /^audio/.test(test.type) ? "audio" : "video";
let element = document.createElement(elemType);
element.src = test.name;
element.preload = "metadata";
element.token = token;
element.controls = true;
element.bufferingTime = 0;

View File

@ -62,6 +62,7 @@ function startTest(test, token) {
var v = document.createElement('video');
manager.started(token);
v.src = test.name;
v.preload = "metadata";
v.token = token;
document.body.appendChild(v);
var name = test.name + " seek test " + test.number;

View File

@ -24,6 +24,7 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
preload="metadata"
src='seekLies.sjs'
onloadedmetadata='on_metadataloaded();'></video>
</body>

View File

@ -30,6 +30,7 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
<video id='v'
preload="metadata"
src='contentDuration6.sjs'
onloadedmetadata='on_metadataloaded();'></video>
</body>

View File

@ -43,6 +43,7 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
<audio id='v'
preload="metadata"
onloadedmetadata='return startTest();'>
<source type='audio/x-wav' src='wavedata_s16.wav'>
</audio>

View File

@ -43,6 +43,7 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
<audio id='v'
preload="metadata"
onloadedmetadata='return startTest();'>
<source type='audio/x-wav' src='wavedata_u8.wav'>
</audio>

View File

@ -98,30 +98,7 @@
"content/html/document/test/test_bug445004.html": "",
"content/html/document/test/test_bug446483.html": "",
"content/html/document/test/test_bug741266.html": "",
"content/media/test/test_autoplay_contentEditable.html": "",
"content/media/test/test_buffered.html": "",
"content/media/test/test_bug448534.html": "",
"content/media/test/test_bug463162.xhtml": "",
"content/media/test/test_bug686137.html": "TIMED_OUT",
"content/media/test/test_contentDuration1.html": "TIMED_OUT",
"content/media/test/test_contentDuration2.html": "TIMED_OUT",
"content/media/test/test_contentDuration3.html": "TIMED_OUT",
"content/media/test/test_contentDuration4.html": "TIMED_OUT",
"content/media/test/test_contentDuration5.html": "TIMED_OUT",
"content/media/test/test_contentDuration6.html": "TIMED_OUT",
"content/media/test/test_contentDuration7.html": "",
"content/media/test/test_decoder_disable.html": "",
"content/media/test/test_fragment_noplay.html": "",
"content/media/test/test_fragment_play.html": "",
"content/media/test/test_framebuffer.html": "",
"content/media/test/test_media_selection.html": "",
"content/media/test/test_playback.html": "",
"content/media/test/test_playback_rate.html": "bug 845162",
"content/media/test/test_seek.html": "bug 845162",
"content/media/test/test_seekLies.html": "TIMED_OUT",
"content/media/test/test_seekable2.html": "",
"content/media/test/test_wave_data_s16.html": "TIMED_OUT",
"content/media/test/test_wave_data_u8.html": "TIMED_OUT",
"content/media/webspeech/synth/ipc/test/test_ipc.html": "bug 857673",
"content/media/webspeech/recognition/test/test_nested_eventloop.html": "",
"content/smil/test/test_smilRepeatTiming.xhtml": "TIMED_OUT",

View File

@ -95,28 +95,7 @@
"content/html/document/test/test_bug445004.html": "",
"content/html/document/test/test_bug446483.html": "",
"content/html/document/test/test_bug741266.html": "",
"content/media/test/test_autoplay_contentEditable.html": "",
"content/media/test/test_buffered.html": "",
"content/media/test/test_bug448534.html": "",
"content/media/test/test_bug463162.xhtml": "",
"content/media/test/test_bug686137.html": "TIMED_OUT",
"content/media/test/test_contentDuration1.html": "TIMED_OUT",
"content/media/test/test_contentDuration2.html": "TIMED_OUT",
"content/media/test/test_contentDuration3.html": "TIMED_OUT",
"content/media/test/test_contentDuration4.html": "TIMED_OUT",
"content/media/test/test_contentDuration5.html": "TIMED_OUT",
"content/media/test/test_contentDuration6.html": "TIMED_OUT",
"content/media/test/test_contentDuration7.html": "",
"content/media/test/test_decoder_disable.html": "",
"content/media/test/test_fragment_noplay.html": "",
"content/media/test/test_fragment_play.html": "",
"content/media/test/test_framebuffer.html": "",
"content/media/test/test_media_selection.html": "",
"content/media/test/test_playback.html": "",
"content/media/test/test_seekLies.html": "TIMED_OUT",
"content/media/test/test_seekable2.html": "",
"content/media/test/test_wave_data_s16.html": "TIMED_OUT",
"content/media/test/test_wave_data_u8.html": "TIMED_OUT",
"content/media/webaudio/test/test_currentTime.html": "bug 868116",
"content/media/webaudio/test/test_delayNode.html": "bug 865642",
"content/media/webaudio/test/test_delayNodeWithGain.html": "bug 865642",

View File

@ -10,30 +10,17 @@
"content/xbl/":"",
"content/xul":"",
"content/media/test/test_bug448534.html": "",
"content/media/test/test_bug448534.html": "Timed out, bug 894922?",
"content/media/test/test_bug495300.html":"",
"content/media/test/test_bug495300.html":"",
"content/media/test/test_bug463162.xhtml":"",
"content/media/test/test_bug495145.html": "timed out",
"content/media/test/test_bug686942.html": "timed out",
"content/media/test/test_bug686137.html": "TIMED_OUT",
"content/media/test/test_can_play_type.html":"timed out",
"content/media/test/test_chaining.html": "timed out",
"content/media/test/test_contentDuration1.html": "TIMED_OUT",
"content/media/test/test_contentDuration2.html": "TIMED_OUT",
"content/media/test/test_contentDuration3.html": "TIMED_OUT",
"content/media/test/test_contentDuration4.html": "TIMED_OUT",
"content/media/test/test_contentDuration5.html": "TIMED_OUT",
"content/media/test/test_contentDuration6.html": "TIMED_OUT",
"content/media/test/test_contentDuration7.html": "timed out",
"content/media/test/test_decoder_disable.html":"timed out",
"content/media/test/test_error_on_404.html": "timed out",
"content/media/test/test_fragment_noplay.html": "timed out",
"content/media/test/test_fragment_play.html": "",
"content/media/test/test_load.html": "Timed out after gizmo.mp4",
"content/media/test/test_load_candidates.html": "timed out",
"content/media/test/test_load_same_resource.html": "",
"content/media/test/test_media_selection.html": "",
"content/media/test/test_media_selection.html": "timed out",
"content/media/test/test_metadata.html": "",
"content/media/test/test_mozHasAudio.html": "",
"content/media/test/test_playback_rate_playpause.html": "",
@ -42,11 +29,8 @@
"content/media/test/test_replay_metadata.html": "",
"content/media/test/test_seekable1.html": "",
"content/media/test/test_seek_out_of_range.html": "",
"content/media/test/test_seekLies.html": "",
"content/media/test/test_wave_data_s16.html": "",
"content/media/test/test_source.html": "",
"content/media/test/test_source_media.html": "",
"content/media/test/test_wave_data_u8.html": "",
"content/media/mediasource/test/test_MediaSource.html": " ReferenceError: MediaSource is not defined",
"content/media/test/test_bug654550.html": "timed out",
@ -54,17 +38,13 @@
"content/media/test/test_info_leak.html": "2 failures",
"content/media/test/test_play_events.html": "Last event should be canplaythrough for gizmo.mp4 - got playing, expected canplaythrough",
"content/media/test/test_play_events_2.html": "Last event should be canplaythrough for gizmo.mp4 - got playing, expected canplaythrough",
"content/media/test/test_playback.html": "Test timed out",
"content/media/test/test_play_events.html": "Last event should be canplaythrough for gizmo.mp4 - got playing, expected canplaythrough",
"content/media/test/test_play_events_2.html": "Last event should be canplaythrough for gizmo.mp4 - got playing, expected canplaythrough",
"content/media/test/test_playback.html": "Test timed out",
"content/media/test/test_playback.html": "Test timed out, bug 668973?",
"content/media/test/test_streams_gc.html": "Value being assigned to HTMLMediaElement.currentTime is not a finite floating-point value",
"content/media/webspeech/recognition/test/test_nested_eventloop.html": "NS_ERROR_NOT_AVAILABLE: [nsIDOMWindow.showModalDialog]",
"content/media/webspeech/synth/ipc/test/test_ipc.html": "comp.classes['@mozilla.org/special-powers-observer;1'] is undefined",
"content/media/webspeech/synth/test/test_speech_queue.html": "Test timed out",
"content/media/webspeech/synth/test/test_speech_simple.html": "Test timed out",
"content/media/test/test_framebuffer.html": "timed out",
"content/media/test/test_seekable2.html": "timed out",
"content/media/test/test_seekable3.html": "timed out",
"content/media/webspeech/recognition/test/test_recognition_service_error.html": "timed out",
"content/media/test/test_can_play_type_mpeg.html":"7 failures out of 27",