Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / mediarecorder / MediaRecorder-basic-video.html
blobfff0eea42e9098dbf4a57ad462671af65050d25f
1 <!DOCTYPE html>
2 <script src=../../resources/testharness.js></script>
3 <script src=../../resources/testharnessreport.js></script>
4 <script>
6 var test = async_test('checks the video-only MediaRecorder API.');
8 recorderOnDataAvailable = test.step_func(function(event) {
9 assert_greater_than(event.data.size, 0, 'Recorded data size should be > 0');
10 assert_equals(recorder.state, "recording");
12 // TODO(mcasas): Let the test record for a while.
13 // TODO(mcasas): Consider storing the recorded data and playing it back.
15 test.done();
16 });
18 recorderOnStop = test.step_func(function() {
19 assert_unreached('Recording stopped.');
20 });
22 gotStream = test.step_func(function(stream) {
23 assert_equals(stream.getAudioTracks().length, 0);
24 assert_equals(stream.getVideoTracks().length, 1);
25 assert_equals(stream.getVideoTracks()[0].readyState, 'live');
27 try {
28 recorder = new MediaRecorder(stream);
29 } catch (e) {
30 assert_unreached('Exception while creating MediaRecorder: ' + e);
33 assert_equals(recorder.state, "inactive");
34 recorder.ondataavailable = recorderOnDataAvailable;
35 recorder.onstop = recorderOnStop;
36 recorder.start();
38 assert_equals(recorder.state, "recording");
39 test.done();
40 });
42 onError = test.step_func(function() {
43 assert_unreached('Error creating MediaRecorder.');
44 });
46 try {
47 navigator.webkitGetUserMedia({video:true}, gotStream, onError);
48 } catch(e) {
49 assert_unreached('Exception launching getUserMedia(): ' + e);
52 </script>