| Index: third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-creation.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-creationAndGrabFrame.html b/third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-creation.html
|
| similarity index 53%
|
| rename from third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-creationAndGrabFrame.html
|
| rename to third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-creation.html
|
| index df02f76ef63e370eb50fb3df0389627124a581f9..8cfadc4edafdf985ee79df8d892e04b8071494c7 100644
|
| --- a/third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-creationAndGrabFrame.html
|
| +++ b/third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-creation.html
|
| @@ -5,34 +5,19 @@
|
| <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.
|
| +// Media Stream Track types (audio, video).
|
|
|
| -var test = async_test('exercises the ImageCapture API creation and grabFrame().');
|
| -
|
| -gotStream = test.step_func(function(stream) {
|
| - assert_equals(stream.getAudioTracks().length, 1);
|
| +var testVideo = promise_test(function() {
|
| + const gotStream = this.step_func(function(stream) {
|
| + assert_equals(stream.getAudioTracks().length, 0);
|
| 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]);
|
|
|
| + var 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.
|
| @@ -47,13 +32,33 @@ gotStream = test.step_func(function(stream) {
|
| 'InvalidStateError',
|
| 'ImageCapturer cannot grabFrame() of a non-live Track');
|
|
|
| - test.done();
|
| -});
|
| + this.done();
|
| + });
|
|
|
| -onError = test.step_func(function() {
|
| + const onError = this.step_func(function() {
|
| assert_unreached('Error creating MediaStream');
|
| -});
|
| + });
|
| +
|
| + navigator.webkitGetUserMedia({video:true}, gotStream, onError);
|
| +}, 'verifies that ImageCapture API rejects grabFrame() in certain Track states.');
|
| +
|
| +var testAudio = promise_test(function() {
|
| + const onError = this.step_func(function() {
|
| + assert_unreached('Error creating MediaStream');
|
| + });
|
| +
|
| + navigator.webkitGetUserMedia({audio:true},
|
| + this.step_func(function(stream) {
|
| + assert_equals(stream.getAudioTracks().length, 1);
|
| + assert_equals(stream.getVideoTracks().length, 0);
|
| + assert_throws("NotSupportedError",
|
| + function() {
|
| + var capturer = new ImageCapture(stream.getAudioTracks()[0]);
|
| + },
|
| + 'an ImageCapturer can only be created from a video track');
|
|
|
| -navigator.webkitGetUserMedia({video:true, audio:true}, gotStream, onError);
|
| + this.done();
|
| + }), onError);
|
| +}, 'verifies that an ImageCapture cannot be created out of an Audio Track');
|
|
|
| </script>
|
|
|