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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/webrtc/webrtc_media_recorder_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/media/mediarecorder_test.html
diff --git a/content/test/data/media/mediarecorder_test.html b/content/test/data/media/mediarecorder_test.html
index 95a66894fe68ad1c3b4cb37818b3e779e6130052..55c2d72e266cee09c6c41c6bec3180b330be0d9d 100644
--- a/content/test/data/media/mediarecorder_test.html
+++ b/content/test/data/media/mediarecorder_test.html
@@ -538,6 +538,49 @@ function testTwoChannelAudio() {
});
}
+// Tests that MediaRecorder can handle video input with alpha channel.
+function testTransparentVideoInput(mimeType) {
mcasas 2017/03/17 01:16:48 micro-nit: s/testTransparentVideoInput/testRecordW
emircan 2017/03/20 17:55:23 Done.
+ const ON_DATA_AVAILABLE_THRESHOLD = 10;
+ const NUMBER_OF_EVENTS_TO_RECORD = 5;
+
+ var canvas = document.createElement('canvas');
+ canvas.width = canvas.height = 64;
+ var stream = canvas.captureStream();
+ assertTrue(stream, 'Error creating MediaStream');
+ assertEquals(1, stream.getVideoTracks().length);
+ assertEquals(0, stream.getAudioTracks().length);
+ var recordedEvents = 0;
+
+ function drawOnCanvas(canvas) {
+ var ctx = canvas.getContext('2d', {alpha: true});
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+ requestAnimationFrame( function() { drawOnCanvas(canvas); });
+ }
+
+ createMediaRecorder(stream, mimeType)
+ .then(function(recorder) {
+ recorder.ondataavailable = function(event) {
+ if (event.data.size > ON_DATA_AVAILABLE_THRESHOLD)
+ ++recordedEvents;
+ };
+ recorder.start(0);
+ drawOnCanvas(canvas);
+ })
+ .then(function() {
+ return waitFor('Make sure the recording has data',
+ function() {
+ return recordedEvents > NUMBER_OF_EVENTS_TO_RECORD;
+ });
+ })
+ .catch(function(err) {
+ return failTest(err.toString());
+ })
+ .then(function() {
+ reportTestSuccess();
+ });
+}
+
// Tests that MediaRecorder's requestData() throws an exception if |state| is
// 'inactive'.
function testIllegalRequestDataThrowsDOMError() {
« 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