Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <script src="../../resources/js-test.js"></script> | |
|
mlamouri (slow - plz ping)
2015/08/13 13:31:47
Could you use testharness so we can share the test
mcasas
2015/08/13 18:42:16
Done.
| |
| 2 <script> | |
| 3 description("This Test checks the video-only MediaRecorder API."); | |
| 4 | |
| 5 var stream; | |
| 6 var recorder; | |
| 7 | |
| 8 window.jsTestIsAsync = true; | |
| 9 | |
| 10 function onError() { | |
| 11 testFailed('Error callback called.'); | |
| 12 finishJSTest(); | |
| 13 } | |
| 14 | |
| 15 function recorderOnStart() { | |
| 16 testPassed('Recording started.'); | |
| 17 } | |
| 18 | |
| 19 function recorderOnDataAvailable(event) { | |
| 20 testPassed('Recorded data received, size: ' + event.data.size); | |
| 21 shouldBeGreaterThan('event.data.size', '0'); | |
| 22 | |
| 23 // TODO(mcasas): Let the test record for a while. | |
| 24 // TODO(mcasas): Consider storing the recorded data and playing it back. | |
| 25 | |
| 26 testPassed('Some data recorded.'); | |
| 27 finishJSTest(); | |
| 28 } | |
| 29 | |
| 30 function recorderOnStop() { | |
| 31 testFailed('Recording stopped.'); | |
| 32 recorder = null | |
| 33 finishJSTest() | |
| 34 } | |
| 35 | |
| 36 function gotStream(s) { | |
| 37 stream = s; | |
| 38 testPassed('Stream generated.'); | |
| 39 shouldBe('stream.getAudioTracks().length', '0'); | |
| 40 shouldBe('stream.getVideoTracks().length', '1'); | |
| 41 | |
| 42 shouldNotThrow("recorder = new MediaRecorder(stream);"); | |
| 43 if (!recorder) | |
| 44 finishJSTest(); | |
| 45 shouldNotThrow("recorder.onstart = recorderOnStart;"); | |
| 46 shouldNotThrow("recorder.ondataavailable = recorderOnDataAvailable;"); | |
| 47 shouldNotThrow("recorder.onstop = recorderOnStop;"); | |
| 48 shouldNotThrow("recorder.start();"); | |
| 49 } | |
| 50 | |
| 51 shouldNotThrow("navigator.webkitGetUserMedia({video:true}, gotStream, onError);" ); | |
| 52 </script> | |
| OLD | NEW |