Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/mediarecorder/MediaRecorder-events-and-exceptions.html

Issue 1652373004: MediaRecorder: add and wire read {video,audio}BitsPerSecond props (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: philipj@ nits Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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('exercises the MediaRecorder API event chain: ' + 6 var test = async_test('exercises the MediaRecorder API event chain: ' +
7 'onstart->onpaused->onresumed->onstopped in sequence, and also potential ' + 7 'onstart->onpaused->onresumed->onstopped in sequence, and also potential ' +
8 'exceptions that are thrown underway.'); 8 'exceptions that are thrown underway.');
9 var recorder; 9 var recorder;
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 assert_equals(stream.getAudioTracks().length, 0); 60 assert_equals(stream.getAudioTracks().length, 0);
61 assert_equals(stream.getVideoTracks().length, 1); 61 assert_equals(stream.getVideoTracks().length, 1);
62 assert_equals(stream.getVideoTracks()[0].readyState, 'live'); 62 assert_equals(stream.getVideoTracks()[0].readyState, 'live');
63 63
64 assert_throws("NotSupportedError", 64 assert_throws("NotSupportedError",
65 function() { 65 function() {
66 recorder = new MediaRecorder(stream, {mimeType : "video/in valid"}); 66 recorder = new MediaRecorder(stream, {mimeType : "video/in valid"});
67 }, 67 },
68 "recorder should throw() with unsupported mimeType"); 68 "recorder should throw() with unsupported mimeType");
69 69
70 try { 70 recorder = new MediaRecorder(stream);
71 recorder = new MediaRecorder(stream);
72 } catch (e) {
73 assert_unreached('Exception while creating MediaRecorder: ' + e);
74 }
75 assert_equals(recorder.state, "inactive"); 71 assert_equals(recorder.state, "inactive");
76 72
77 assert_throws("InvalidStateError", function() { recorder.stop() }, 73 assert_throws("InvalidStateError", function() { recorder.stop() },
78 "recorder cannot be stop()ped in |inactive| state"); 74 "recorder cannot be stop()ped in |inactive| state");
79 assert_throws("InvalidStateError", function() { recorder.pause() }, 75 assert_throws("InvalidStateError", function() { recorder.pause() },
80 "recorder cannot be pause()ed in |inactive| state"); 76 "recorder cannot be pause()ed in |inactive| state");
81 assert_throws("InvalidStateError", function() { recorder.resume() }, 77 assert_throws("InvalidStateError", function() { recorder.resume() },
82 "recorder cannot be resume()d in |inactive| state"); 78 "recorder cannot be resume()d in |inactive| state");
83 assert_throws("InvalidStateError", function() { recorder.requestData() }, 79 assert_throws("InvalidStateError", function() { recorder.requestData() },
84 "cannot requestData() if recorder is in |inactive| state"); 80 "cannot requestData() if recorder is in |inactive| state");
85 81
86 recorder.onstop = recorderOnUnexpectedEvent; 82 recorder.onstop = recorderOnUnexpectedEvent;
87 recorder.onpause = recorderOnUnexpectedEvent; 83 recorder.onpause = recorderOnUnexpectedEvent;
88 recorder.onresume = recorderOnUnexpectedEvent; 84 recorder.onresume = recorderOnUnexpectedEvent;
89 recorder.onerror = recorderOnUnexpectedEvent; 85 recorder.onerror = recorderOnUnexpectedEvent;
90 recorder.ondataavailable = recorderOnDataAvailable; 86 recorder.ondataavailable = recorderOnDataAvailable;
91 recorder.onstart = recorderOnStart; 87 recorder.onstart = recorderOnStart;
92 88
93 recorder.start(); 89 recorder.start();
94 assert_equals(recorder.state, "recording"); 90 assert_equals(recorder.state, "recording");
95 }); 91 });
96 92
97 try { 93 navigator.webkitGetUserMedia({video:true}, gotStream, recorderOnUnexpectedEvent) ;
98 navigator.webkitGetUserMedia({video:true}, gotStream, recorderOnUnexpectedEv ent);
99 } catch(e) {
100 assert_unreached('Exception launching getUserMedia(): ' + e);
101 }
102 94
103 </script> 95 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698