Chromium Code Reviews| 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 // This test verifies that MediaRecorder can be created with different Media | 5 // This test verifies that MediaRecorder can be created with different Media |
| 6 // Stream Track combinations: 1 Video Track only, 1 Audio Track only and finally | 6 // Stream Track combinations: 1 Video Track only, 1 Audio Track only and finally |
| 7 // a Media Stream with both a Video and an Audio Track. Note that recording is | 7 // a Media Stream with both a Video and an Audio Track. Note that recording is |
| 8 // _not_ started in this test, see MediaRecorder-basic-video.html for it. | 8 // _not_ started in this test, see MediaRecorder-basic-video.html for it. |
| 9 | 9 |
| 10 function makeAsyncTest(constraints, verifyStream, message) { | 10 function makeAsyncTest(constraints, verifyStream, message) { |
| 11 return async_test(function(test) { | 11 return async_test(function(test) { |
| 12 | 12 |
| 13 var gotStream = test.step_func(function(stream) { | 13 var gotStream = test.step_func(function(stream) { |
| 14 verifyStream(stream); | 14 verifyStream(stream); |
| 15 | 15 |
| 16 try { | 16 try { |
| 17 recorder = new MediaRecorder(stream); | 17 recorder = new MediaRecorder(stream); |
| 18 } catch (e) { | 18 } catch (e) { |
| 19 assert_unreached('Exception while creating MediaRecorder: ' + e) ; | 19 assert_unreached('Exception while creating MediaRecorder: ' + e) ; |
| 20 } | 20 } |
| 21 assert_equals(recorder.state, "inactive"); | 21 assert_equals(recorder.state, "inactive"); |
| 22 assert_equals(recorder.videoBitsPerSecond, 0); | |
|
philipj_slow
2016/02/03 03:31:05
That seems weird, why shouldn't this return the de
mcasas
2016/02/03 23:50:27
Because the bitrate, when left by JS as undefined,
philipj_slow
2016/02/04 03:03:10
Well, the encoder isn't really targeting a zero bi
| |
| 23 assert_equals(recorder.audioBitsPerSecond, 0); | |
| 22 test.done(); | 24 test.done(); |
| 23 }); | 25 }); |
| 24 | 26 |
| 25 var onError = test.step_func(function() { | 27 var onError = test.step_func(function() { |
| 26 assert_unreached('Error creating MediaRecorder.'); | 28 assert_unreached('Error creating MediaRecorder.'); |
| 27 }); | 29 }); |
| 28 | 30 |
| 29 try { | 31 try { |
| 30 navigator.webkitGetUserMedia(constraints, gotStream, onError); | 32 navigator.webkitGetUserMedia(constraints, gotStream, onError); |
| 31 } catch(e) { | 33 } catch(e) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 50 assert_equals(stream.getVideoTracks()[0].readyState, 'live'); | 52 assert_equals(stream.getVideoTracks()[0].readyState, 'live'); |
| 51 assert_equals(stream.getAudioTracks()[0].readyState, 'live'); | 53 assert_equals(stream.getAudioTracks()[0].readyState, 'live'); |
| 52 } | 54 } |
| 53 | 55 |
| 54 // Note: webkitGetUserMedia() must be called with at least video or audio true. | 56 // Note: webkitGetUserMedia() must be called with at least video or audio true. |
| 55 makeAsyncTest({video:true}, verifyVideoOnlyStream, 'Video only MediaRecorder'); | 57 makeAsyncTest({video:true}, verifyVideoOnlyStream, 'Video only MediaRecorder'); |
| 56 makeAsyncTest({audio:true}, verifyAudioOnlyStream, 'Audio only MediaRecorder'); | 58 makeAsyncTest({audio:true}, verifyAudioOnlyStream, 'Audio only MediaRecorder'); |
| 57 makeAsyncTest({audio:true, video:true}, verifyAudioVideoStream, 'Video and Audio MediaRecorder'); | 59 makeAsyncTest({audio:true, video:true}, verifyAudioVideoStream, 'Video and Audio MediaRecorder'); |
| 58 | 60 |
| 59 </script> | 61 </script> |
| OLD | NEW |