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