Chromium Code Reviews| 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 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script> | 7 <script> |
| 8 description("Test cloning mediastreams onended."); | 8 description("Test cloning mediastreams oninactive."); |
|
hta - Chromium
2015/01/14 14:12:02
While you're at it, can you fix this to be a gramm
| |
| 9 | 9 |
| 10 var cloned_stream; | 10 var cloned_stream; |
| 11 | 11 |
| 12 function onStreamEnded() { | 12 function error() { |
| 13 testPassed('Stream ended.'); | 13 testFailed('Stream generation failed.'); |
| 14 finishJSTest(); | 14 finishJSTest(); |
| 15 } | 15 } |
| 16 | 16 |
| 17 function onTrackAdded() { | 17 function getUserMedia(dictionary, callback) { |
| 18 testPassed('Mock test track added.'); | 18 try { |
| 19 shouldBe('cloned_stream.getVideoTracks().length', '1'); | 19 navigator.webkitGetUserMedia(dictionary, callback, error); |
| 20 cloned_stream.getVideoTracks()[0].stop(); | 20 } catch (e) { |
| 21 testFailed('webkitGetUserMedia threw exception :' + e); | |
| 22 finishJSTest(); | |
| 23 } | |
| 21 } | 24 } |
| 22 | 25 |
| 23 function run(s) { | 26 function onStreamInactive() { |
| 24 cloned_stream = new webkitMediaStream(); | 27 testPassed('Stream inactive.'); |
|
hta - Chromium
2015/01/14 14:12:02
Also check that active is false here.
| |
| 25 cloned_stream.onaddtrack = onTrackAdded; | 28 finishJSTest(); |
| 26 cloned_stream.onended = onStreamEnded; | |
| 27 } | 29 } |
| 28 | 30 |
| 29 run(); | 31 function gotStream(s) { |
| 32 stream = s; | |
| 33 | |
| 34 cloned_stream = stream.clone(); | |
| 35 cloned_stream.oninactive = onStreamInactive; | |
|
hta - Chromium
2015/01/14 14:12:02
Also check that active is true here.
| |
| 36 shouldBe('cloned_stream.getVideoTracks().length', '1'); | |
| 37 shouldBe('cloned_stream.getAudioTracks().length', '1'); | |
| 38 cloned_stream.getVideoTracks()[0].stop(); | |
| 39 cloned_stream.getAudioTracks()[0].stop(); | |
| 40 } | |
| 41 | |
| 42 getUserMedia({audio:true, video:true}, gotStream); | |
| 30 | 43 |
| 31 window.jsTestIsAsync = true; | 44 window.jsTestIsAsync = true; |
| 32 window.successfullyParsed = true; | 45 window.successfullyParsed = true; |
| 33 </script> | 46 </script> |
| 34 </body> | 47 </body> |
| 35 </html> | 48 </html> |
| OLD | NEW |