Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
| 2 <html> | |
| 3 <head> | |
|
esprehn
2015/08/12 22:27:34
leave out html, head and body.
mcasas
2015/08/13 09:31:50
Done.
| |
| 4 <script src="../../resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <p id="description"></p> | |
| 8 <div id="console"></div> | |
|
esprehn
2015/08/12 22:27:34
it creates these for you, leave out description an
mcasas
2015/08/13 09:31:50
Done.
| |
| 9 <script> | |
| 10 description("This Test checks the video-only MediaRecorder API."); | |
| 11 | |
| 12 var stream; | |
| 13 var recorder; | |
| 14 | |
| 15 function onError() { | |
| 16 testFailed('Error callback called.'); | |
| 17 finishJSTest(); | |
| 18 } | |
| 19 | |
| 20 function recorderOnStart() { | |
| 21 testPassed('Recording started.'); | |
| 22 } | |
| 23 | |
| 24 function recorderOnDataAvailable(event) { | |
| 25 testPassed('Recorded data received, size: ' + event.data.size); | |
| 26 shouldBeGreaterThan('event.data.size', '0'); | |
| 27 | |
| 28 // TODO(mcasas): Let the test record for a while. | |
| 29 // TODO(mcasas): Consider storing the recorded data and playing it back. | |
| 30 | |
| 31 testPassed('Some data recorded.'); | |
| 32 finishJSTest(); | |
| 33 } | |
| 34 | |
| 35 function recorderOnStop() { | |
| 36 testFailed('Recording stopped.'); | |
| 37 recorder = null | |
| 38 finishJSTest() | |
| 39 } | |
| 40 | |
| 41 function gotStream(s) { | |
| 42 stream = s; | |
| 43 testPassed('Stream generated.'); | |
| 44 shouldBe('stream.getAudioTracks().length', '0'); | |
| 45 shouldBe('stream.getVideoTracks().length', '1'); | |
| 46 | |
| 47 shouldNotThrow("recorder = new MediaRecorder(stream);"); | |
| 48 if (!recorder) | |
| 49 finishJSTest(); | |
| 50 shouldNotThrow("recorder.onstart = recorderOnStart;"); | |
| 51 shouldNotThrow("recorder.ondataavailable = recorderOnDataAvailable;"); | |
| 52 shouldNotThrow("recorder.onstop = recorderOnStop;"); | |
| 53 shouldNotThrow("recorder.start();"); | |
| 54 } | |
| 55 | |
| 56 shouldNotThrow("navigator.webkitGetUserMedia({video:true}, gotStream, onError);" ); | |
| 57 | |
| 58 window.jsTestIsAsync = true; | |
|
esprehn
2015/08/12 22:27:34
Move to top.
mcasas
2015/08/13 09:31:50
Done.
| |
| 59 window.successfullyParsed = true; | |
|
esprehn
2015/08/12 22:27:34
Don't set this yourself, it should do it for you.
mcasas
2015/08/13 09:31:50
Done.
| |
| 60 </script> | |
| 61 </body> | |
| 62 </html> | |
| OLD | NEW |