2 <script src=../../resources/testharness.js
></script>
3 <script src=../../resources/testharnessreport.js
></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.
18 recorderOnStop
= test
.step_func(function() {
19 assert_unreached('Recording stopped.');
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');
28 recorder
= new MediaRecorder(stream
);
30 assert_unreached('Exception while creating MediaRecorder: ' + e
);
33 assert_equals(recorder
.state
, "inactive");
34 recorder
.ondataavailable
= recorderOnDataAvailable
;
35 recorder
.onstop
= recorderOnStop
;
38 assert_equals(recorder
.state
, "recording");
42 onError
= test
.step_func(function() {
43 assert_unreached('Error creating MediaRecorder.');
47 navigator
.webkitGetUserMedia({video
:true}, gotStream
, onError
);
49 assert_unreached('Exception launching getUserMedia(): ' + e
);