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

Side by Side Diff: third_party/WebKit/LayoutTests/imagecapture/setoptions.html

Issue 2301053004: Image Capture: adding fillLightMode getting/setting (Closed)
Patch Set: Created 4 years, 3 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
11 const meteringModeNames = ["unavailable", "manual", "single-shot", "continuous"] ; 11 const meteringModeNames = ["none", "manual", "single-shot", "continuous"];
12 const fillLightModeNames = ["none", "off", "auto", "flash", "torch"];
12 13
13 // This test verifies that ImageCapture can call setOptions()s, with a mock Mojo 14 // This test verifies that ImageCapture can call setOptions()s, with a mock Mojo
14 // interface implementation. 15 // interface implementation.
15 async_test(function(t) { 16 async_test(function(t) {
16 var canvas = document.getElementById('canvas'); 17 var canvas = document.getElementById('canvas');
17 var context = canvas.getContext("2d"); 18 var context = canvas.getContext("2d");
18 context.fillStyle = "red"; 19 context.fillStyle = "red";
19 context.fillRect(0, 0, 10, 10); 20 context.fillRect(0, 0, 10, 10);
20 var stream = canvas.captureStream(); 21 var stream = canvas.captureStream();
21 22
22 var theMock = null; 23 var theMock = null;
23 const optionsDict = { zoom : 7, 24 const optionsDict = { zoom : 7,
24 imageWidth : 1080, 25 imageWidth : 1080,
25 imageHeight : 100, 26 imageHeight : 100,
26 focusMode : "single-shot", 27 focusMode : "single-shot",
27 pointsOfInterest : [{x : 0.1, y : 0.2}, 28 pointsOfInterest : [{x : 0.1, y : 0.2},
28 {x : 0.3, y : 0.4}], 29 {x : 0.3, y : 0.4}],
29 exposureMode : "continuous", 30 exposureMode : "continuous",
30 exposureCompensation : 133, 31 exposureCompensation : 133,
31 whiteBalanceMode : "manual", 32 whiteBalanceMode : "manual",
32 iso : 120, 33 iso : 120,
33 redEyeReduction : true, 34 redEyeReduction : true,
35 fillLightMode : "flash",
34 }; 36 };
35 mockImageCaptureReady 37 mockImageCaptureReady
36 .then(mock => { 38 .then(mock => {
37 theMock = mock; 39 theMock = mock;
38 return new ImageCapture(stream.getVideoTracks()[0]); 40 return new ImageCapture(stream.getVideoTracks()[0]);
39 }) 41 })
40 .catch(error => { 42 .catch(error => {
41 assert_unreached("Error creating MockImageCapture: " + error); 43 assert_unreached("Error creating MockImageCapture: " + error);
42 }) 44 })
43 .then(capturer => { 45 .then(capturer => {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 'whiteBalanceMode value'); 84 'whiteBalanceMode value');
83 assert_equals(true, theMock.options().has_iso, 'has_iso must be true'); 85 assert_equals(true, theMock.options().has_iso, 'has_iso must be true');
84 assert_equals(optionsDict.iso, theMock.options().iso, 'iso value'); 86 assert_equals(optionsDict.iso, theMock.options().iso, 'iso value');
85 assert_equals(true, theMock.options().has_red_eye_reduction, 87 assert_equals(true, theMock.options().has_red_eye_reduction,
86 'has_red_eye_reduction must be true'); 88 'has_red_eye_reduction must be true');
87 // Depending on how mojo boolean packing in integers is arranged, this can 89 // Depending on how mojo boolean packing in integers is arranged, this can
88 // be a number instead of a boolean, compare directly. 90 // be a number instead of a boolean, compare directly.
89 // TODO(mcasas): Revert to assert_equals() when yzshen@ has sorted it out. 91 // TODO(mcasas): Revert to assert_equals() when yzshen@ has sorted it out.
90 assert_true(optionsDict.redEyeReduction == theMock.options().red_eye_reduc tion, 92 assert_true(optionsDict.redEyeReduction == theMock.options().red_eye_reduc tion,
91 'red_eye_reduction value'); 93 'red_eye_reduction value');
94 assert_equals(true, theMock.options().has_fill_light_mode, 'has_fill_light _mode must be true');
95 assert_equals(optionsDict.fillLightMode,
96 fillLightModeNames[theMock.options().fill_light_mode],
97 'fillLightMode value');
92 98
93 t.done(); 99 t.done();
94 }) 100 })
95 .catch(error => { 101 .catch(error => {
96 assert_unreached("Error during setOptions(): " + error); 102 assert_unreached("Error during setOptions(): " + error);
97 }); 103 });
98 }, 'exercises the ImageCapture API setOptions()'); 104 }, 'exercises the ImageCapture API setOptions()');
99 105
100 </script> 106 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698