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

Unified Diff: third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-creationAndGrabFrame.html

Issue 1890313002: MediaStream Image Capture (1): idl and wireframe .h/.cpp/LayoutTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODO for the mentioned LayoutTests Created 4 years, 8 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 | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-creationAndGrabFrame.html
diff --git a/third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-creationAndGrabFrame.html b/third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-creationAndGrabFrame.html
new file mode 100644
index 0000000000000000000000000000000000000000..df02f76ef63e370eb50fb3df0389627124a581f9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-creationAndGrabFrame.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<script src=../../resources/testharness.js></script>
+<script src=../../resources/testharnessreport.js></script>
+<script src=../../resources/testharness-helpers.js></script>
+<script>
+
+// This test verifies that ImageCapture can be created (or not) with different
+// Media Stream Track types (audio, video). The simplest API method grabFrame()
+// is also exercised here.
+
+var test = async_test('exercises the ImageCapture API creation and grabFrame().');
+
+gotStream = test.step_func(function(stream) {
+ assert_equals(stream.getAudioTracks().length, 1);
+ assert_equals(stream.getVideoTracks().length, 1);
+ assert_throws("NotSupportedError",
+ function() {
+ capturer = new ImageCapture(stream.getAudioTracks()[0]);
+ },
+ 'an ImageCapturer can only be created from a video track');
+
+ assert_equals(stream.getVideoTracks()[0].readyState, 'live');
+ assert_true(stream.getVideoTracks()[0].enabled);
+ assert_false(stream.getVideoTracks()[0].muted);
+ capturer = new ImageCapture(stream.getVideoTracks()[0]);
+
+ assert_equals(capturer.videoStreamTrack, stream.getVideoTracks()[0]);
+
+ // TODO(mcasas): Remove this assert after the method is implemented, and
+ // substitute with something more relevant.
+ stream.getVideoTracks()[0].enabled = true;
+ assert_promise_rejects(capturer.grabFrame(),
+ 'NotSupportedError',
+ 'ImageCapturer grabFrame() is not implemented');
+
+ // Assert that grabFrame() is rejected if the associated video track is
+ // disabled, or ended. grabFrame() would also reject if the video Track is
+ // muted but that's a read-only property.
+ stream.getVideoTracks()[0].enabled = false;
+ assert_promise_rejects(capturer.grabFrame(),
+ 'InvalidStateError',
+ 'ImageCapturer cannot grabFrame() of a disabled Track');
+
+ stream.getVideoTracks()[0].stop();
+ assert_equals(stream.getVideoTracks()[0].readyState, 'ended');
+ assert_promise_rejects(capturer.grabFrame(),
+ 'InvalidStateError',
+ 'ImageCapturer cannot grabFrame() of a non-live Track');
+
+ test.done();
+});
+
+onError = test.step_func(function() {
+ assert_unreached('Error creating MediaStream');
+});
+
+navigator.webkitGetUserMedia({video:true, audio:true}, gotStream, onError);
+
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698