OLD | NEW |
| (Empty) |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
2 <html> | |
3 <head> | |
4 <link rel="stylesheet" href="../js/resources/js-test-style.css"> | |
5 <script src="../js/resources/js-test-pre.js"></script> | |
6 </head> | |
7 <body> | |
8 <p id="description"></p> | |
9 <div id="console"></div> | |
10 <script> | |
11 description("Tests LocalMediaStream::onended callback."); | |
12 | |
13 function error() { | |
14 testFailed('Stream generation failed.'); | |
15 finishJSTest(); | |
16 } | |
17 | |
18 function getUserMedia(dictionary, callback) { | |
19 try { | |
20 navigator.webkitGetUserMedia(dictionary, callback, error); | |
21 } catch (e) { | |
22 testFailed('webkitGetUserMedia threw exception :' + e); | |
23 finishJSTest(); | |
24 } | |
25 } | |
26 | |
27 var stream; | |
28 | |
29 function streamEnded() { | |
30 testPassed('streamEnded was called.'); | |
31 shouldBeTrue('stream.ended'); | |
32 finishJSTest(); | |
33 } | |
34 | |
35 function gotStream(s) { | |
36 stream = s; | |
37 shouldBeFalse('stream.ended'); | |
38 try { | |
39 stream.onended = streamEnded; | |
40 stream.stop(); | |
41 } catch (e) { | |
42 testFailed('LocalMediaStream threw exception :' + e); | |
43 finishJSTest(); | |
44 } | |
45 } | |
46 | |
47 getUserMedia({audio:true, video:true}, gotStream); | |
48 | |
49 window.jsTestIsAsync = true; | |
50 window.successfullyParsed = true; | |
51 </script> | |
52 <script src="../js/resources/js-test-post.js"></script> | |
53 </body> | |
54 </html> | |
OLD | NEW |