OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src=../../resources/testharness.js></script> |
| 3 <script src=../../resources/testharnessreport.js></script> |
| 4 <script> |
| 5 // This test verifies that MediaRecorder can be created or not with different |
| 6 // bitrates for video, audio and for both [1]. |
| 7 // TODO(mcasas): test also the expected allocated values once [2] is closed. |
| 8 // [1] https://rawgit.com/w3c/mediacapture-record/master/MediaRecorder.html#Medi
aRecorderOptions |
| 9 // [2] https://github.com/w3c/mediacapture-record/issues/43 |
| 10 |
| 11 |
| 12 function makeAsyncTest(options, message) { |
| 13 return async_test(function(test) { |
| 14 const constraints = {video: true, audio: false}; |
| 15 |
| 16 const gotStream = test.step_func(function(stream) { |
| 17 assert_throws("NotSupportedError", |
| 18 function() { |
| 19 var recorder = new MediaRecorder(stream, options); |
| 20 }, |
| 21 "recorder rejects too large bit rates"); |
| 22 test.done(); |
| 23 }); |
| 24 |
| 25 const onError = this.step_func(function() { |
| 26 assert_unreached('Error creating MediaStream.'); |
| 27 }); |
| 28 |
| 29 try { |
| 30 navigator.webkitGetUserMedia(constraints, gotStream, onError); |
| 31 } |
| 32 catch (e) { |
| 33 assert_unreached('Exception launching getUserMedia(): ' + e); |
| 34 } |
| 35 }, message); |
| 36 }; |
| 37 |
| 38 makeAsyncTest({audioBitsPerSecond:4294967294}, 'Audio bitrate too large'); |
| 39 makeAsyncTest({videoBitsPerSecond:4294967294}, 'Video bitrate too large'); |
| 40 makeAsyncTest({bitsPerSecond:4294967294}, 'Overall bitrate too large'); |
| 41 |
| 42 </script> |
OLD | NEW |