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

Unified Diff: content/test/data/media/video_audio_element_capture_test.html

Issue 2104643002: MediaCaptureFromElement: add content_browsertests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow <video>/<audio>.play() for tests when not initiated by user gesture. Created 4 years, 6 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/test/data/media/canvas_capture_color.html ('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/video_audio_element_capture_test.html
diff --git a/content/test/data/media/video_audio_element_capture_test.html b/content/test/data/media/video_audio_element_capture_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..ac21a8d25e51c1c91a594a86e12076ef911ab91d
--- /dev/null
+++ b/content/test/data/media/video_audio_element_capture_test.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Media Capture from DOM Elements (video/audio) Browser Test</title>
+</head>
+<body>
+ <div> Capture and playback from video/audio elements.</div>
+ <video id="video"></video>
+ <audio id="audio"></audio>
+</body>
+<script type="text/javascript" src="webrtc_test_utilities.js"></script>
+<script>
+
+'use strict';
+
+const NUMBER_OF_EVENTS_TO_RECORD = 100;
+
+function testCaptureFromMediaElement(filename,
+ has_video,
+ has_audio,
+ use_audio_tag) {
+ const element = use_audio_tag ? document.getElementById('audio')
+ : document.getElementById('video');
+ assertTrue(element, 'Error resolving tag');
+
+ element.src = filename;
+ element.onerror = function(e) {
+ failTest("error playing back [" + filename + "] " + e);
+ }
+
+ var recorded_events = 0;
+ element.onloadedmetadata = function() {
+ const stream = element.captureStream();
+ assertTrue(stream, 'Error creating MediaStream');
+ assertEquals(has_video, stream.getVideoTracks().length);
+ assertEquals(has_audio, stream.getAudioTracks().length);
+
+ const recorder = new MediaRecorder(stream);
+ assertTrue(recorder, 'Error creating recorder out of the MediaStream');
+
+ recorder.ondataavailable = function(event) {
+ if (++recorded_events > NUMBER_OF_EVENTS_TO_RECORD)
+ reportTestSuccess();
+ };
+
+ recorder.start();
+ element.play();
+ };
+}
+
+</script>
+</body>
+</html>
« no previous file with comments | « content/test/data/media/canvas_capture_color.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698