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

Side by Side Diff: content/test/data/media/mediarecorder_test.html

Issue 2757793002: Add transparent video input test for WebRtcMediaRecorderBrowserTest (Closed)
Patch Set: Created 3 years, 9 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 | « content/browser/webrtc/webrtc_media_recorder_browsertest.cc ('k') | no next file » | 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 <html> 2 <html>
3 <head> 3 <head>
4 <title>MediaStream Recoder Browser Test (w/ MediaSource)</title> 4 <title>MediaStream Recoder Browser Test (w/ MediaSource)</title>
5 </head> 5 </head>
6 <body> 6 <body>
7 <div> Record Real-Time video content browser test.</div> 7 <div> Record Real-Time video content browser test.</div>
8 <video id="video" autoplay></video> 8 <video id="video" autoplay></video>
9 <video id="remoteVideo" autoplay></video> 9 <video id="remoteVideo" autoplay></video>
10 </body> 10 </body>
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 }) 531 })
532 .catch(function(err) { 532 .catch(function(err) {
533 return failTest(err.toString()); 533 return failTest(err.toString());
534 }) 534 })
535 .then(function() { 535 .then(function() {
536 console.log('audioSize', audioSize); 536 console.log('audioSize', audioSize);
537 reportTestSuccess(); 537 reportTestSuccess();
538 }); 538 });
539 } 539 }
540 540
541 // Tests that MediaRecorder can handle video input with alpha channel.
542 function testTransparentVideoInput(mimeType) {
mcasas 2017/03/17 01:16:48 micro-nit: s/testTransparentVideoInput/testRecordW
emircan 2017/03/20 17:55:23 Done.
543 const ON_DATA_AVAILABLE_THRESHOLD = 10;
544 const NUMBER_OF_EVENTS_TO_RECORD = 5;
545
546 var canvas = document.createElement('canvas');
547 canvas.width = canvas.height = 64;
548 var stream = canvas.captureStream();
549 assertTrue(stream, 'Error creating MediaStream');
550 assertEquals(1, stream.getVideoTracks().length);
551 assertEquals(0, stream.getAudioTracks().length);
552 var recordedEvents = 0;
553
554 function drawOnCanvas(canvas) {
555 var ctx = canvas.getContext('2d', {alpha: true});
556 ctx.fillStyle = 'green';
557 ctx.fillRect(0, 0, canvas.width, canvas.height);
558 requestAnimationFrame( function() { drawOnCanvas(canvas); });
559 }
560
561 createMediaRecorder(stream, mimeType)
562 .then(function(recorder) {
563 recorder.ondataavailable = function(event) {
564 if (event.data.size > ON_DATA_AVAILABLE_THRESHOLD)
565 ++recordedEvents;
566 };
567 recorder.start(0);
568 drawOnCanvas(canvas);
569 })
570 .then(function() {
571 return waitFor('Make sure the recording has data',
572 function() {
573 return recordedEvents > NUMBER_OF_EVENTS_TO_RECORD;
574 });
575 })
576 .catch(function(err) {
577 return failTest(err.toString());
578 })
579 .then(function() {
580 reportTestSuccess();
581 });
582 }
583
541 // Tests that MediaRecorder's requestData() throws an exception if |state| is 584 // Tests that MediaRecorder's requestData() throws an exception if |state| is
542 // 'inactive'. 585 // 'inactive'.
543 function testIllegalRequestDataThrowsDOMError() { 586 function testIllegalRequestDataThrowsDOMError() {
544 navigator.mediaDevices.getUserMedia(DEFAULT_CONSTRAINTS) 587 navigator.mediaDevices.getUserMedia(DEFAULT_CONSTRAINTS)
545 .then(function(stream) { 588 .then(function(stream) {
546 return createMediaRecorder(stream, DEFAULT_RECORDER_MIME_TYPE); 589 return createMediaRecorder(stream, DEFAULT_RECORDER_MIME_TYPE);
547 }) 590 })
548 .then(function(recorder) { 591 .then(function(recorder) {
549 assertThrows(function() {recorder.requestData()}, 592 assertThrows(function() {recorder.requestData()},
550 'Calling requestdata() in inactive state should throw a DOM ' + 593 'Calling requestdata() in inactive state should throw a DOM ' +
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 return failTest(err.toString()); 654 return failTest(err.toString());
612 }) 655 })
613 .then(function() { 656 .then(function() {
614 reportTestSuccess(); 657 reportTestSuccess();
615 }); 658 });
616 } 659 }
617 660
618 </script> 661 </script>
619 </body> 662 </body>
620 </html> 663 </html>
OLDNEW
« no previous file with comments | « content/browser/webrtc/webrtc_media_recorder_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698