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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/mediarecorder/MediaRecorder-requestData.html

Issue 2207613003: MediaRecorder: add mime type to recorded blobs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This test verifies we can successfully create a MediaRecorder and 6 // This test verifies we can successfully create a MediaRecorder and
7 // get data from a MediaStream with it. 7 // get data from a MediaStream with it.
8 8
9 var checkStreamTracks = function(stream, has_video, has_audio) { 9 var checkStreamTracks = function(stream, has_video, has_audio) {
10 if (has_video) { 10 if (has_video) {
11 assert_equals(stream.getVideoTracks().length, 1); 11 assert_equals(stream.getVideoTracks().length, 1);
12 assert_equals(stream.getVideoTracks()[0].readyState, 'live'); 12 assert_equals(stream.getVideoTracks()[0].readyState, 'live');
13 } else { 13 } else {
14 assert_equals(stream.getVideoTracks().length, 0); 14 assert_equals(stream.getVideoTracks().length, 0);
15 } 15 }
16 16
17 if (has_audio) { 17 if (has_audio) {
18 assert_equals(stream.getAudioTracks().length, 1); 18 assert_equals(stream.getAudioTracks().length, 1);
19 assert_equals(stream.getAudioTracks()[0].readyState, 'live'); 19 assert_equals(stream.getAudioTracks()[0].readyState, 'live');
20 } else { 20 } else {
21 assert_equals(stream.getAudioTracks().length, 0); 21 assert_equals(stream.getAudioTracks().length, 0);
22 } 22 }
23 }; 23 };
24 24
25 var makeAsyncTest = function(value, expected) { 25 var makeAsyncTest = function(value, expected) {
26 async_test(function(test) { 26 async_test(function(test) {
27 const recorderOnDataAvailable = test.step_func_done(function(event) { 27 const recorderOnDataAvailable = test.step_func_done(function(event) {
28 assert_equals(event.data.size, 0, 28 assert_equals(event.data.size, 0,
29 'Recorded data size should be == 0'); 29 'Recorded data size should be == 0');
30 assert_equals(event.data.type, "video/webm");
30 }); 31 });
31 32
32 const recorderOnStop = test.step_func(function() { 33 const recorderOnStop = test.step_func(function() {
33 assert_unreached('Recording stopped.'); 34 assert_unreached('Recording stopped.');
34 }); 35 });
35 36
36 const recorderOnError = test.step_func(function() { 37 const recorderOnError = test.step_func(function() {
37 assert_unreached('Recording error.'); 38 assert_unreached('Recording error.');
38 }); 39 });
39 40
40 const gotStream = test.step_func_done(function(stream) { 41 const gotStream = test.step_func(function(stream) {
41 checkStreamTracks(stream, value['video'], value['audio']); 42 checkStreamTracks(stream, value['video'], value['audio']);
42 43
43 var recorder = new MediaRecorder(stream); 44 var recorder = new MediaRecorder(stream);
44 45
45 assert_throws("InvalidStateError", 46 assert_throws("InvalidStateError",
46 function() { 47 function() {
47 recorder.requestData(); 48 recorder.requestData();
48 }, 49 },
49 "recorder throws InvalidStateError if requestData() while state is not 'recording'"); 50 "recorder throws InvalidStateError if requestData() while state is not 'recording'");
50 51
(...skipping 10 matching lines...) Expand all
61 navigator.webkitGetUserMedia(value, gotStream, onError); 62 navigator.webkitGetUserMedia(value, gotStream, onError);
62 }); 63 });
63 }; 64 };
64 65
65 generate_tests(makeAsyncTest, 66 generate_tests(makeAsyncTest,
66 [["video-only", {video: true, audio: false}], 67 [["video-only", {video: true, audio: false}],
67 ["audio-only", {video: false, audio: true}], 68 ["audio-only", {video: false, audio: true}],
68 ["audio-video", {video: true, audio: true}]]); 69 ["audio-video", {video: true, audio: true}]]);
69 70
70 </script> 71 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698