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

Unified Diff: third_party/WebKit/LayoutTests/fast/mediacapturefromelement/HTMLMediaElementCapture-creation.html

Issue 1599533003: MediaCaptureFromElement: add support for audio captureStream(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: using refptr iso WeakPtr Created 4 years, 7 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
Index: third_party/WebKit/LayoutTests/fast/mediacapturefromelement/HTMLMediaElementCapture-creation.html
diff --git a/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/HTMLMediaElementCapture-creation.html b/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/HTMLMediaElementCapture-creation.html
index d481fc8175e9bb75a93203da28b57129c4f93aa9..a9be5072c826e35625303b3bd260d4ed43b696bb 100644
--- a/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/HTMLMediaElementCapture-creation.html
+++ b/third_party/WebKit/LayoutTests/fast/mediacapturefromelement/HTMLMediaElementCapture-creation.html
@@ -2,7 +2,8 @@
<script src=../../resources/testharness.js></script>
<script src=../../resources/testharnessreport.js></script>
<script>
-// Run createStream() on <video>s and <audio>s.
+
+// Run captureStream() on <video>/<audio>s and inspect the generated Stream.
test(function() {
var video = document.createElement('video');
@@ -16,49 +17,30 @@ test(function() {
"captureStream() cannot be created out of a source-less <audio>" );
}, 'check that captureStream() raises an exception on an <audio> with no source.');
-test(function() {
- var video = document.createElement('video');
- video.src = "file:///super_duper_videos/amazing_video.webm";
- video.onloadstart = function() {
- var stream = video.captureStream();
-
- assert_not_equals(stream, null);
- assert_equals(1, stream.getVideoTracks().length);
- assert_equals(0, stream.getAudioTracks().length);
- }
-}, 'check <video> captureStream().');
-
-test(function() {
- var audio = document.createElement('audio');
- audio.src = "file:///super_duper_videos/amazing_audio_file.webm";
- audio.onloadstart = function() {
- var stream = audio.captureStream();
-
- // TODO(mcasas): http://crbug.com/575492, implement <audio>.captureStream().
- assert_equals(stream, null);
- };
-}, 'check <audio> captureStream().');
+var makeAsyncTest = function(filename, num_video_tracks, num_audio_tracks) {
+ async_test(function() {
+ var video = document.createElement('video');
+ video.src = "../../http/tests/media/resources/media-source/webm/" + filename;
+ video.onerror = this.unreached_func("<video> error");
-test(function() {
- var video = document.createElement('video');
+ video.onloadedmetadata = this.step_func_done(function() {
+ assert_equals(video.audioTracks.length, num_audio_tracks);
+ assert_equals(video.videoTracks.length, num_video_tracks);
- const onEncrypted = this.step_func_done();
+ var stream = video.captureStream();
+ assert_not_equals(stream, null, "error generating stream");
- assert_equals(null, video.error);
- assert_equals(null, video.mediaKeys);
- video.onencrypted = onEncrypted;
+ assert_equals(stream.getAudioTracks().length, num_audio_tracks);
+ assert_equals(stream.getVideoTracks().length, num_video_tracks);
+ });
- navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
- return access.createMediaKeys();
- }).then(function(mediaKeys) {
- return video.setMediaKeys(mediaKeys);
- }).then(function(result) {
- video.src = "../../media/content/test-encrypted.webm";
- assert_throws("NotSupportedError",
- function() { var stream = video.captureStream(); },
- "Cannot create a captureStream() out of a protected <video>");
- });
+ video.load();
+ }), "<video>.captureStream()";
+};
-}, 'check <video> captureStream() fails on an encrypted/protected media');
+generate_tests(makeAsyncTest,
+ [[ "video-only", "test-v-128k-320x240-24fps-8kfr.webm", 1, 0 ],
+ [ "audio-only", "test-a-128k-44100Hz-1ch.webm", 0, 1 ],
+ [ "video+audio", "test.webm", 1, 1 ]]);
</script>

Powered by Google App Engine
This is Rietveld 408576698