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