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

Side by Side Diff: third_party/WebKit/LayoutTests/imagecapture/MediaStreamTrack-applyConstraints.html

Issue 2819653003: Image Capture: Reject applyConstraints() if passed an unsupported constraint (Closed)
Patch Set: Created 3 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 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/mojo-helpers.js"></script> 4 <script src="../resources/mojo-helpers.js"></script>
5 <script src="resources/mock-imagecapture.js"></script> 5 <script src="resources/mock-imagecapture.js"></script>
6 <body> 6 <body>
7 <canvas id='canvas' width=10 height=10/> 7 <canvas id='canvas' width=10 height=10/>
8 </body> 8 </body>
9 <script> 9 <script>
10 10
(...skipping 23 matching lines...) Expand all
34 contrast : 4, 34 contrast : 4,
35 saturation : 5, 35 saturation : 5,
36 sharpness : 6, 36 sharpness : 6,
37 37
38 zoom : 3.141592, 38 zoom : 3.141592,
39 39
40 torch : true 40 torch : true
41 }]}; 41 }]};
42 42
43 var theMock = null; 43 var theMock = null;
44 var videoTrack = null;
44 mockImageCaptureReady 45 mockImageCaptureReady
45 .then(mock => { 46 .then(mock => {
46 theMock = mock; 47 theMock = mock;
47 var stream = canvas.captureStream(); 48 var stream = canvas.captureStream();
48 var videoTrack = stream.getVideoTracks()[0]; 49 videoTrack = stream.getVideoTracks()[0];
49 50
50 return videoTrack.applyConstraints(constraints); 51 // |videoTrack|s capabilities, just like the actual capture, is a process
52 // kicked right after creation, we introduce a small delay to allow for
Reilly Grant (use Gerrit) 2017/04/14 19:46:17 Missing words? Should be "|videoTrack|'s capabilit
mcasas 2017/04/14 21:21:27 Rewritten, here and in the next file.
53 // those to be collected.
54 // TODO(mcasas): this shouldn't be needed, https://crbug.com/711524.
55 return new Promise((resolve) => setTimeout(resolve, 100));
Reilly Grant (use Gerrit) 2017/04/14 19:46:17 nit: no parenthesis around a single argument
mcasas 2017/04/14 21:21:27 Done.
51 }, 56 },
52 error => { 57 error => {
53 assert_unreached("Error creating MockImageCapture: " + error); 58 assert_unreached("Error creating MockImageCapture: " + error);
54 }) 59 })
55 .then(function() { 60 .then(function() {
61 return videoTrack.applyConstraints(constraints);
62 })
63 .then(function() {
56 assert_equals(constraints.advanced[0].whiteBalanceMode, 64 assert_equals(constraints.advanced[0].whiteBalanceMode,
57 meteringModeNames[theMock.options().white_balance_mode], 65 meteringModeNames[theMock.options().white_balance_mode],
58 'whiteBalanceMode'); 66 'whiteBalanceMode');
59 assert_equals(constraints.advanced[0].exposureMode, 67 assert_equals(constraints.advanced[0].exposureMode,
60 meteringModeNames[theMock.options().exposure_mode], 68 meteringModeNames[theMock.options().exposure_mode],
61 'exposureMode'); 69 'exposureMode');
62 assert_equals(constraints.advanced[0].focusMode, 70 assert_equals(constraints.advanced[0].focusMode,
63 meteringModeNames[theMock.options().focus_mode], 71 meteringModeNames[theMock.options().focus_mode],
64 'focusMode'); 72 'focusMode');
65 73
(...skipping 30 matching lines...) Expand all
96 104
97 t.done(); 105 t.done();
98 }) 106 })
99 .catch(error => { 107 .catch(error => {
100 assert_unreached("applyConstraints(): " + error.message); 108 assert_unreached("applyConstraints(): " + error.message);
101 }) 109 })
102 110
103 }, 'exercises MediaStreamTrack.applyConstraints(constraints)'); 111 }, 'exercises MediaStreamTrack.applyConstraints(constraints)');
104 112
105 </script> 113 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698