| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src=../../resources/testharness.js></script> | 2 <script src=../../resources/testharness.js></script> |
| 3 <script src=../../resources/testharnessreport.js></script> | 3 <script src=../../resources/testharnessreport.js></script> |
| 4 <script> | 4 <script> |
| 5 | 5 |
| 6 var test = async_test('checks the video-only MediaRecorder API.'); | 6 var test = async_test('checks the video-only MediaRecorder API.'); |
| 7 | 7 |
| 8 recorderOnDataAvailable = test.step_func(function(event) { | 8 recorderOnDataAvailable = test.step_func(function(event) { |
| 9 assert_greater_than(event.data.size, 0, 'Recorded data size should be > 0'); | 9 assert_greater_than(event.data.size, 0, 'Recorded data size should be > 0'); |
| 10 assert_equals(recorder.state, "recording"); | 10 assert_equals(recorder.state, "recording"); |
| 11 | 11 |
| 12 // TODO(mcasas): Let the test record for a while. | 12 // TODO(mcasas): Let the test record for a while. |
| 13 // TODO(mcasas): Consider storing the recorded data and playing it back. | 13 // TODO(mcasas): Consider storing the recorded data and playing it back. |
| 14 | 14 |
| 15 test.done(); | 15 test.done(); |
| 16 }); | 16 }); |
| 17 | 17 |
| 18 recorderOnStop = test.step_func(function() { | 18 recorderOnStop = test.step_func(function() { |
| 19 assert_unreached('Recording stopped.'); | 19 assert_unreached('Recording stopped.'); |
| 20 }); | 20 }); |
| 21 | 21 |
| 22 gotStream = test.step_func(function(s) { | 22 gotStream = test.step_func(function(stream) { |
| 23 stream = s; | |
| 24 assert_equals(stream.getAudioTracks().length, 0); | 23 assert_equals(stream.getAudioTracks().length, 0); |
| 25 assert_equals(stream.getVideoTracks().length, 1); | 24 assert_equals(stream.getVideoTracks().length, 1); |
| 26 assert_equals(stream.getVideoTracks()[0].readyState, 'live'); | 25 assert_equals(stream.getVideoTracks()[0].readyState, 'live'); |
| 27 | 26 |
| 28 try { | 27 try { |
| 29 recorder = new MediaRecorder(stream); | 28 recorder = new MediaRecorder(stream); |
| 30 } catch (e) { | 29 } catch (e) { |
| 31 assert_unreached('Exception while creating MediaRecorder: ' + e); | 30 assert_unreached('Exception while creating MediaRecorder: ' + e); |
| 32 } | 31 } |
| 33 | 32 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 44 assert_unreached('Error creating MediaRecorder.'); | 43 assert_unreached('Error creating MediaRecorder.'); |
| 45 }); | 44 }); |
| 46 | 45 |
| 47 try { | 46 try { |
| 48 navigator.webkitGetUserMedia({video:true}, gotStream, onError); | 47 navigator.webkitGetUserMedia({video:true}, gotStream, onError); |
| 49 } catch(e) { | 48 } catch(e) { |
| 50 assert_unreached('Exception launching getUserMedia(): ' + e); | 49 assert_unreached('Exception launching getUserMedia(): ' + e); |
| 51 } | 50 } |
| 52 | 51 |
| 53 </script> | 52 </script> |
| OLD | NEW |