content/media/test/test_wav_ended1.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.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Wave Media test: ended</title>
michael@0 5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 7 </head>
michael@0 8 <body>
michael@0 9 <pre id="test">
michael@0 10 <script class="testbody" type="text/javascript">
michael@0 11 // Test if the ended event works correctly.
michael@0 12 var endPassed = false;
michael@0 13 var completed = false;
michael@0 14
michael@0 15 function startTest() {
michael@0 16 if (completed)
michael@0 17 return;
michael@0 18 var v = document.getElementById('v');
michael@0 19 v.play();
michael@0 20 }
michael@0 21
michael@0 22 function playbackEnded() {
michael@0 23 if (completed)
michael@0 24 return;
michael@0 25
michael@0 26 var v = document.getElementById('v');
michael@0 27 completed = true;
michael@0 28 ok(v.currentTime >= 0.9 && v.currentTime <= 1.1,
michael@0 29 "Checking currentTime at end: " + v.currentTime);
michael@0 30 ok(v.ended, "Checking playback has ended");
michael@0 31 SimpleTest.finish();
michael@0 32 }
michael@0 33
michael@0 34 SimpleTest.waitForExplicitFinish();
michael@0 35 </script>
michael@0 36 </pre>
michael@0 37 <audio id='v'
michael@0 38 onloadedmetadata='return startTest();'
michael@0 39 onended='return playbackEnded();'>
michael@0 40 <source type='audio/x-wav' src='r11025_s16_c1.wav'>
michael@0 41 </audio>
michael@0 42 </body>
michael@0 43 </html>

mercurial