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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-creation.html

Issue 1926813004: Replace assert_promise_rejects with upstream promise_rejects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update testharness.js and rebase 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src=../../resources/testharness.js></script> 2 <script src=../../resources/testharness.js></script>
3 <script src=../../resources/testharnessreport.js></script> 3 <script src=../../resources/testharnessreport.js></script>
4 <script src=../../resources/testharness-helpers.js></script> 4 <script src=../../resources/testharness-helpers.js></script>
5 <script> 5 <script>
6 6
7 // This test verifies that ImageCapture can be created (or not) with different 7 // This test verifies that ImageCapture can be created (or not) with different
8 // Media Stream Track types (audio, video). 8 // Media Stream Track types (audio, video).
9 9
10 var testVideo = promise_test(function() { 10 var testVideo = promise_test(function() {
11 const gotStream = this.step_func(function(stream) { 11 const gotStream = this.step_func(function(stream) {
12 assert_equals(stream.getAudioTracks().length, 0); 12 assert_equals(stream.getAudioTracks().length, 0);
13 assert_equals(stream.getVideoTracks().length, 1); 13 assert_equals(stream.getVideoTracks().length, 1);
14 assert_equals(stream.getVideoTracks()[0].readyState, 'live'); 14 assert_equals(stream.getVideoTracks()[0].readyState, 'live');
15 assert_true(stream.getVideoTracks()[0].enabled); 15 assert_true(stream.getVideoTracks()[0].enabled);
16 assert_false(stream.getVideoTracks()[0].muted); 16 assert_false(stream.getVideoTracks()[0].muted);
17 17
18 var capturer = new ImageCapture(stream.getVideoTracks()[0]); 18 var capturer = new ImageCapture(stream.getVideoTracks()[0]);
19 assert_equals(capturer.videoStreamTrack, stream.getVideoTracks()[0]); 19 assert_equals(capturer.videoStreamTrack, stream.getVideoTracks()[0]);
20 20
21 // Assert that grabFrame() is rejected if the associated video track is 21 // Assert that grabFrame() is rejected if the associated video track is
22 // disabled, or ended. grabFrame() would also reject if the video Track is 22 // disabled, or ended. grabFrame() would also reject if the video Track is
23 // muted but that's a read-only property. 23 // muted but that's a read-only property.
24 stream.getVideoTracks()[0].enabled = false; 24 stream.getVideoTracks()[0].enabled = false;
25 assert_promise_rejects(capturer.grabFrame(), 25 promise_rejects(this,
Marijn Kruisselbrink 2016/04/28 19:10:46 These changes aren't strictly correct, but they're
jsbell 2016/04/29 17:39:07 Acknowledged.
26 'InvalidStateError', 26 'InvalidStateError',
27 'ImageCapturer cannot grabFrame() of a disabled Track '); 27 capturer.grabFrame(),
28 'ImageCapturer cannot grabFrame() of a disabled Track');
28 29
29 stream.getVideoTracks()[0].stop(); 30 stream.getVideoTracks()[0].stop();
30 assert_equals(stream.getVideoTracks()[0].readyState, 'ended'); 31 assert_equals(stream.getVideoTracks()[0].readyState, 'ended');
31 assert_promise_rejects(capturer.grabFrame(), 32 promise_rejects(this,
32 'InvalidStateError', 33 'InvalidStateError',
33 'ImageCapturer cannot grabFrame() of a non-live Track '); 34 capturer.grabFrame(),
35 'ImageCapturer cannot grabFrame() of a non-live Track');
34 36
35 this.done(); 37 this.done();
36 }); 38 });
37 39
38 const onError = this.step_func(function() { 40 const onError = this.step_func(function() {
39 assert_unreached('Error creating MediaStream'); 41 assert_unreached('Error creating MediaStream');
40 }); 42 });
41 43
42 navigator.webkitGetUserMedia({video:true}, gotStream, onError); 44 navigator.webkitGetUserMedia({video:true}, gotStream, onError);
43 }, 'verifies that ImageCapture API rejects grabFrame() in certain Track states.' ); 45 }, 'verifies that ImageCapture API rejects grabFrame() in certain Track states.' );
(...skipping 11 matching lines...) Expand all
55 function() { 57 function() {
56 var capturer = new ImageCapture(stream.getAudioTracks()[0] ); 58 var capturer = new ImageCapture(stream.getAudioTracks()[0] );
57 }, 59 },
58 'an ImageCapturer can only be created from a video track'); 60 'an ImageCapturer can only be created from a video track');
59 61
60 this.done(); 62 this.done();
61 }), onError); 63 }), onError);
62 }, 'verifies that an ImageCapture cannot be created out of an Audio Track'); 64 }, 'verifies that an ImageCapture cannot be created out of an Audio Track');
63 65
64 </script> 66 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698