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

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

Issue 2482983002: MediaSettingsRange: s/long/double/ in MediaSettingsRange.idl and PhotoCapabilities.idl (Closed)
Patch Set: s/float/double/ in fake_video_capture_device.* Created 4 years, 1 month 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 = ["none", "manual", "single-shot", "continuous"]; 11 const meteringModeNames = ["none", "manual", "single-shot", "continuous"];
12 const fillLightModeNames = ["none", "off", "auto", "flash", "torch"]; 12 const fillLightModeNames = ["none", "off", "auto", "flash", "torch"];
13 13
14 // 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
15 // interface implementation. 15 // interface implementation.
16 async_test(function(t) { 16 async_test(function(t) {
17 var canvas = document.getElementById('canvas'); 17 var canvas = document.getElementById('canvas');
18 var context = canvas.getContext("2d"); 18 var context = canvas.getContext("2d");
19 context.fillStyle = "red"; 19 context.fillStyle = "red";
20 context.fillRect(0, 0, 10, 10); 20 context.fillRect(0, 0, 10, 10);
21 var stream = canvas.captureStream(); 21 var stream = canvas.captureStream();
22 22
23 var theMock = null; 23 var theMock = null;
24 const optionsDict = { zoom : 7, 24 const optionsDict = { zoom : 1.7,
25 imageWidth : 1080, 25 imageWidth : 1080,
26 imageHeight : 100, 26 imageHeight : 100,
27 focusMode : "single-shot", 27 focusMode : "single-shot",
28 pointsOfInterest : [{x : 0.1, y : 0.2}, 28 pointsOfInterest : [{x : 0.1, y : 0.2},
29 {x : 0.3, y : 0.4}], 29 {x : 0.3, y : 0.4}],
30 exposureMode : "continuous", 30 exposureMode : "continuous",
31 exposureCompensation : 133, 31 exposureCompensation : 133,
32 whiteBalanceMode : "manual", 32 whiteBalanceMode : "manual",
33 iso : 120, 33 iso : 120,
34 redEyeReduction : true, 34 redEyeReduction : true,
(...skipping 10 matching lines...) Expand all
45 return new ImageCapture(stream.getVideoTracks()[0]); 45 return new ImageCapture(stream.getVideoTracks()[0]);
46 }) 46 })
47 .catch(error => { 47 .catch(error => {
48 assert_unreached("Error creating MockImageCapture: " + error); 48 assert_unreached("Error creating MockImageCapture: " + error);
49 }) 49 })
50 .then(capturer => { 50 .then(capturer => {
51 return capturer.setOptions(optionsDict); 51 return capturer.setOptions(optionsDict);
52 }) 52 })
53 .then(function() { 53 .then(function() {
54 assert_true(theMock.options().has_zoom, 'has_zoom must be true'); 54 assert_true(theMock.options().has_zoom, 'has_zoom must be true');
55 assert_equals(optionsDict.zoom, theMock.options().zoom, 'zoom value'); 55 assert_approx_equals(optionsDict.zoom, theMock.options().zoom, 0.1, 'zoom value');
56 assert_equals(true, theMock.options().has_width, 'has_width must be true') ; 56 assert_equals(true, theMock.options().has_width, 'has_width must be true') ;
57 assert_equals(optionsDict.imageWidth, theMock.options().width, 'width valu e'); 57 assert_equals(optionsDict.imageWidth, theMock.options().width, 'width valu e');
58 assert_equals(true, theMock.options().has_height, 'has_height must be true '); 58 assert_equals(true, theMock.options().has_height, 'has_height must be true ');
59 assert_equals(optionsDict.imageHeight, theMock.options().height, 'height v alue'); 59 assert_equals(optionsDict.imageHeight, theMock.options().height, 'height v alue');
60 assert_equals(true, theMock.options().has_focus_mode, 'has_focus_mode must be true'); 60 assert_equals(true, theMock.options().has_focus_mode, 'has_focus_mode must be true');
61 assert_equals(optionsDict.focusMode, 61 assert_equals(optionsDict.focusMode,
62 meteringModeNames[theMock.options().focus_mode], 62 meteringModeNames[theMock.options().focus_mode],
63 'focusMode value'); 63 'focusMode value');
64 assert_equals(optionsDict.pointsOfInterest.length, 64 assert_equals(optionsDict.pointsOfInterest.length,
65 theMock.options().points_of_interest.length, 65 theMock.options().points_of_interest.length,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 'colorTemperature value'); 107 'colorTemperature value');
108 108
109 t.done(); 109 t.done();
110 }) 110 })
111 .catch(error => { 111 .catch(error => {
112 assert_unreached("Error during setOptions(): " + error); 112 assert_unreached("Error during setOptions(): " + error);
113 }); 113 });
114 }, 'exercises the ImageCapture API setOptions()'); 114 }, 'exercises the ImageCapture API setOptions()');
115 115
116 </script> 116 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698