content/media/test/test_texttrackregion.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=917945
     5 -->
     6 <head>
     7   <meta charset='utf-8'>
     8   <title>Test for Bug 917945 - VTTRegion</title>
     9   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
    10   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    11   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    12 </head>
    13 <body>
    14 <p id="display"></p>
    15 <div id="content">
    16 </div>
    17 <pre id="test">
    18 <script class="testbody" type="text/javascript">
    19 SimpleTest.waitForExplicitFinish();
    20 SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true],
    21                                    ["media.webvtt.regions.enabled", true]]},
    22   function() {
    23     var video = document.createElement("video");
    24     video.src = "seek.webm";
    25     video.preload = "auto";
    26     var trackElement = document.createElement("track");
    27     trackElement.src = "region.vtt";
    28     trackElement.kind = "subtitles";
    29     document.getElementById("content").appendChild(video);
    30     video.appendChild(trackElement);
    31     video.addEventListener("loadedmetadata", function run_tests() {
    32       // Re-que run_tests() at the end of the event loop until the track
    33       // element has loaded its data.
    34       if (trackElement.readyState == 1) {
    35         setTimeout(run_tests, 0);
    36         return;
    37       }
    38       is(trackElement.readyState, 2, "Track::ReadyState should be set to LOADED.");
    39       // Set mode to hidden so that the active cue lists are being updated.
    40       trackElement.track.mode = "hidden";
    42       var cues = trackElement.track.cues;
    43       is(cues.length, 1, "Cue list length should be 1.");
    45       var region = cues[0].region;
    46       isnot(region, null, "Region should not be null.");
    47       is(region.width, 62, "Region width should be 50.");
    48       is(region.lines, 5, "Region lines should be 5.");
    49       is(region.regionAnchorX, 4, "Region regionAnchorX should be 4.");
    50       is(region.regionAnchorY, 78, "Region regionAnchorY should be 78.");
    51       is(region.viewportAnchorX, 10, "Region viewportAnchorX should be 10.");
    52       is(region.viewportAnchorY, 90, "Region viewportAnchorY should be 90.");
    53       is(region.scroll, "up", "Region scroll should be 'up'");
    55       SimpleTest.finish();
    56     });
    57   }
    58 );
    60 </script>
    61 </pre>
    62 </body>
    63 </html>

mercurial