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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/mediarecorder/BlobEvent-basic.html

Issue 2610163006: MediaRecorder: support |timecode| and remove |m_ignoreMutedMedia|. (Closed)
Patch Set: Rebase video_capture_device_client.cc Created 3 years, 11 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 test(function() { 6 test(function() {
7 var array = new Uint8Array([0x70, 0x71, 0x72, 0x73]); 7 var array = new Uint8Array([0x70, 0x71, 0x72, 0x73]);
8 var blob = new Blob([array]); 8 var blob = new Blob([array]);
9 var blobEvent = new BlobEvent('BlobEvent', {data : blob}); 9 var blobEvent = new BlobEvent('BlobEvent', {data : blob});
10 10
11 var reader = new FileReader(); 11 var reader = new FileReader();
12 reader.addEventListener("loadend", function() { 12 reader.addEventListener("loadend", function() {
13 // |reader.result| contains the contents of blob as an ArrayBuffer. 13 // |reader.result| contains the contents of blob as an ArrayBuffer.
14 var outputArray = new Uint8Array(reader.result); 14 var outputArray = new Uint8Array(reader.result);
15 assert_array_equals(array, outputArray) 15 assert_array_equals(array, outputArray)
16 }); 16 });
17 reader.readAsArrayBuffer(blob); 17 reader.readAsArrayBuffer(blobEvent.data);
18 assert_equals(blobEvent.timecode, NaN, 'timecode');
18 19
19 }, 'check BlobEvent creation and content management'); 20 }, 'BlobEvent creation and content management');
21
22 test(function() {
23 var array = new Uint8Array([0x70, 0x71, 0x72, 0x73]);
24 var blob = new Blob([array]);
25 var now = Date.now();
26 var blobEvent = new BlobEvent('BlobEvent', {data : blob, timecode : now});
27
28 assert_equals(blobEvent.timecode, now, 'timecode');
29
30 }, 'BlobEvent creation with timecode');
20 31
21 test(function() { 32 test(function() {
22 assert_throws(null, 33 assert_throws(null,
23 function() { var blobEvent = new BlobEvent('BlobEvent'); }); 34 function() { var blobEvent = new BlobEvent('BlobEvent'); });
24 }, 'check BlobEvent needs two constructor parameters, type and BlobEventInit'); 35 }, 'BlobEvent needs two constructor parameters, type and BlobEventInit');
25 36
26 test(function() { 37 test(function() {
38 var array = new Uint8Array([0x70, 0x71, 0x72, 0x73]);
39 var blob = new Blob([array]);
27 assert_throws(null, 40 assert_throws(null,
28 function() { 41 function() {
29 var blobEvent = new BlobEvent('BlobEvent', {data : "blergh"}); 42 var blobEvent = new BlobEvent(blob, {data : "blergh"});
30 }); 43 });
31 }, 'check BlobEvent needs the second constructor parameter to be a BlobEventInit '); 44 }, 'BlobEvent needs the second constructor parameter to be a BlobEventInit');
45
46 test(function() {
47 var array = new Uint8Array([0x70, 0x71, 0x72, 0x73]);
48 var blob = new Blob([array]);
49 assert_throws(null,
50 function() {
51 var blobEvent = new BlobEvent(blob, {timecode : 0.0});
52 });
53 }, 'BlobEventInit needs a data parameter');
32 54
33 </script> 55 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698