content/media/test/test_bug686942.html

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

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=686942
michael@0 5 -->
michael@0 6
michael@0 7 <head>
michael@0 8 <title>Test for Bug 448534</title>
michael@0 9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 11 <script type="text/javascript" src="manifest.js"></script>
michael@0 12 </head>
michael@0 13 <body>
michael@0 14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=686942">Mozilla Bug 686942</a>
michael@0 15 <pre id="test">
michael@0 16 <script class="testbody" type="text/javascript">
michael@0 17
michael@0 18 if (navigator.platform.startsWith("Win")) {
michael@0 19 SimpleTest.expectAssertions(0, 2);
michael@0 20 }
michael@0 21
michael@0 22 var manager = new MediaTestManager;
michael@0 23
michael@0 24 function onloaded(event) {
michael@0 25 var v = event.target;
michael@0 26 v.currentTime = v.duration;
michael@0 27 return;
michael@0 28 }
michael@0 29
michael@0 30 function checkNotPlaying(v) {
michael@0 31 ok(v.currentTime == 0, "Should not be playing after seek to end and back to beginning");
michael@0 32 v._finished = true;
michael@0 33 manager.finished(v.token);
michael@0 34 }
michael@0 35
michael@0 36 function onseeked(event) {
michael@0 37 var v = event.target;
michael@0 38 setTimeout(function() { checkNotPlaying(v); }, 500);
michael@0 39 }
michael@0 40
michael@0 41 function onended(event) {
michael@0 42 var v = event.target;
michael@0 43 if (v._finished)
michael@0 44 return;
michael@0 45 v.addEventListener("seeked", onseeked, false);
michael@0 46 v.currentTime = 0;
michael@0 47 }
michael@0 48
michael@0 49 function startTest(test, token) {
michael@0 50 var v = document.createElement('video');
michael@0 51 v.preload = "auto";
michael@0 52 v.token = token;
michael@0 53 manager.started(token);
michael@0 54 v.src = test.name;
michael@0 55 v._played = false;
michael@0 56 v._finished = false;
michael@0 57 v.addEventListener("loadedmetadata", onloaded, false);
michael@0 58 v.addEventListener("ended", onended, false);
michael@0 59
michael@0 60 document.body.appendChild(v);
michael@0 61 }
michael@0 62
michael@0 63 manager.runTests(gSmallTests, startTest);
michael@0 64
michael@0 65 </script>
michael@0 66 </pre>
michael@0 67 </body>
michael@0 68 </html>

mercurial