content/media/test/test_decoder_disable.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=448600
     5 -->
     6 <head>
     7   <title>Test for Bug 448600</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10 </head>
    11 <body>
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=448600">Mozilla Bug 448600</a>
    13 <p id="display"></p>
    16 <pre id="test">
    17 <script type="application/javascript">
    19 function filename(uri) {
    20   return uri.substr(uri.lastIndexOf("/")+1);
    21 }
    23 function e(id) {
    24   return document.getElementById(id);
    25 }
    27 var gLoadError = new Object();
    29 gLoadError['video1'] = 0; 
    30 gLoadError['video2'] = 0;
    31 gLoadError['video3'] = 0;
    33 var gErrorCount = 0;
    35 SimpleTest.waitForExplicitFinish();
    37 function finishTest() {
    38   is(e('video1').currentSrc,
    39      "",
    40      'video1 currentSrc should be empty when there\'s no playable typed source children');
    41   is(filename(e('video2').currentSrc),
    42      filename(e('video2').src),
    43      'video2 currentSrc should match src');
    44   is(filename(e('video3').currentSrc),
    45      filename(e('video3').src),
    46      'video3 currentSrc should match src');
    48   is(gLoadError['video1'], 2, "Expect one error per invalid source child on video1");
    49   is(gLoadError['video2'], 1, "Expect one error on video2");
    50   is(gLoadError['video3'], 1, "Expect one error on video3");
    52   SimpleTest.finish();
    53 }
    55 function videoError(event, id) {
    56   gLoadError[id]++;
    57   gErrorCount++;
    58   if (gErrorCount >= 4) {
    59     finishTest();
    60   }
    61 }
    63 </script>
    64 <!-- We make the resource URIs unique to ensure that they are (re)loaded with the new disable-decoder prefs. -->
    65 <div id="content">
    66 </div>
    67 <script>
    68 function makeVideos() {
    69   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>';
    70 }
    72 SpecialPowers.pushPrefEnv({"set": [["media.ogg.enabled", false], ["media.wave.enabled", false]]}, makeVideos);
    73 </script>
    75 </pre>
    77 </body>
    78 </html>

mercurial