| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <link rel="stylesheet" href="../js/resources/js-test-style.css"> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| <script> |
| description("Tests MediaStream::onended callback."); |
| |
| function error() { |
| testFailed('Stream generation failed.'); |
| finishJSTest(); |
| } |
| |
| function getUserMedia(dictionary, callback) { |
| try { |
| navigator.webkitGetUserMedia(dictionary, callback, error); |
| } catch (e) { |
| testFailed('webkitGetUserMedia threw exception :' + e); |
| finishJSTest(); |
| } |
| } |
| |
| var stream; |
| |
| function streamEnded() { |
| testPassed('streamEnded was called.'); |
| shouldBeTrue('stream.ended'); |
| finishJSTest(); |
| } |
| |
| function gotStream(s) { |
| stream = new webkitMediaStream(s); |
| shouldBeFalse('stream.ended'); |
| try { |
| stream.onended = streamEnded; |
| s.stop(); |
| } catch (e) { |
| testFailed('LocalMediaStream threw exception :' + e); |
| finishJSTest(); |
| } |
| } |
| |
| getUserMedia({audio:true, video:true}, gotStream); |
| |
| window.jsTestIsAsync = true; |
| window.successfullyParsed = true; |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |