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 | <head> |
michael@0 | 4 | <title>Media test: Test resume of server-dropped connections</title> |
michael@0 | 5 | <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> |
michael@0 | 6 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 7 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 8 | </head> |
michael@0 | 9 | <body> |
michael@0 | 10 | <audio preload="auto" id="a"></audio> |
michael@0 | 11 | <iframe id="f"></iframe> |
michael@0 | 12 | <pre id="test"> |
michael@0 | 13 | <script class="testbody" type="text/javascript"> |
michael@0 | 14 | var key = Math.round(Math.random()*1000000000); |
michael@0 | 15 | var a = document.getElementById("a"); |
michael@0 | 16 | var f = document.getElementById("f"); |
michael@0 | 17 | |
michael@0 | 18 | function didEnd() { |
michael@0 | 19 | ok(a.currentTime > 2.26, "Reached correct end time (got " + a.currentTime + ", expected > 2.26"); |
michael@0 | 20 | SimpleTest.finish(); |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | function didSendCancel() { |
michael@0 | 24 | a.addEventListener("ended", didEnd, false); |
michael@0 | 25 | a.play(); |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | function didSuspend() { |
michael@0 | 29 | a.removeEventListener("suspend", didSuspend, false); |
michael@0 | 30 | |
michael@0 | 31 | // Cache must have filled up, or something. Tell the Web server to drop |
michael@0 | 32 | // our connection. |
michael@0 | 33 | f.addEventListener("load", didSendCancel, false); |
michael@0 | 34 | f.src = "cancellable_request.sjs?cancelkey=" + key; |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | if (!a.canPlayType("audio/wave")) { |
michael@0 | 38 | todo(false, "Test requires support for audio/wave"); |
michael@0 | 39 | } else { |
michael@0 | 40 | a.addEventListener("suspend", didSuspend, false); |
michael@0 | 41 | a.src = "cancellable_request.sjs?key=" + key; |
michael@0 | 42 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 43 | } |
michael@0 | 44 | </script> |
michael@0 | 45 | </pre> |
michael@0 | 46 | </body> |
michael@0 | 47 | </html> |