content/media/test/test_loop.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>Test looping support</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 <script type="text/javascript" src="manifest.js"></script>
michael@0 8 </head>
michael@0 9 <body>
michael@0 10 <pre id="test">
michael@0 11 <script class="testbody" type="text/javascript">
michael@0 12 var manager = new MediaTestManager;
michael@0 13
michael@0 14 function startTest(test, token) {
michael@0 15 manager.started(token);
michael@0 16 var v = document.createElement('video');
michael@0 17 v.token = token;
michael@0 18 v.src = test.name;
michael@0 19 v.name = test.name;
michael@0 20 v.playCount = 0;
michael@0 21 v.seekingCount = 0;
michael@0 22 v.seekedCount = 0;
michael@0 23 v.loop = true;
michael@0 24
michael@0 25 v.addEventListener("play", function (e) {
michael@0 26 e.target.playCount += 1;
michael@0 27 ok(e.target.playCount == 1, "Should get exactly one play event.");
michael@0 28 }, false);
michael@0 29
michael@0 30 v.addEventListener("seeking", function (e) {
michael@0 31 e.target.seekingCount += 1;
michael@0 32 }, false);
michael@0 33
michael@0 34 v.addEventListener("seeked", function (e) {
michael@0 35 e.target.seekedCount += 1;
michael@0 36 if (e.target.seekedCount == 3) {
michael@0 37 ok(e.target.seekingCount == 3, "Expect matched pairs of seeking/seeked events.");
michael@0 38 e.target.loop = false;
michael@0 39 }
michael@0 40 }, false);
michael@0 41
michael@0 42 v.addEventListener("ended", function (e) {
michael@0 43 ok(!e.target.loop, "Shouldn't get ended event while looping.");
michael@0 44 removeNodeAndSource(e.target);
michael@0 45 manager.finished(e.target.token);
michael@0 46 }, false);
michael@0 47
michael@0 48 document.body.appendChild(v);
michael@0 49 v.play();
michael@0 50 }
michael@0 51
michael@0 52 manager.runTests(gSmallTests, startTest);
michael@0 53 </script>
michael@0 54 </pre>
michael@0 55 </body>
michael@0 56 </html>

mercurial