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

Side by Side Diff: third_party/WebKit/LayoutTests/imagecapture/resources/mock-imagecapture.js

Issue 2806743003: Image Capture: split {white_balance,exposure,focus}_modes into current_ and supported_ (Closed)
Patch Set: reillyg@ comment and fix in v4l2_capture_delegate.cc 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 "use strict"; 1 "use strict";
2 2
3 let mockImageCaptureReady = define( 3 let mockImageCaptureReady = define(
4 'mockImageCapture', 4 'mockImageCapture',
5 ['media/capture/mojo/image_capture.mojom', 5 ['media/capture/mojo/image_capture.mojom',
6 'mojo/public/js/bindings', 6 'mojo/public/js/bindings',
7 'content/public/renderer/interfaces', 7 'content/public/renderer/interfaces',
8 ], (imageCapture, bindings, interfaces) => { 8 ], (imageCapture, bindings, interfaces) => {
9 9
10 class MockImageCapture { 10 class MockImageCapture {
11 constructor() { 11 constructor() {
12 interfaces.addInterfaceOverrideForTesting( 12 interfaces.addInterfaceOverrideForTesting(
13 imageCapture.ImageCapture.name, 13 imageCapture.ImageCapture.name,
14 handle => this.bindingSet_.addBinding(this, handle)); 14 handle => this.bindingSet_.addBinding(this, handle));
15 15
16 this.state_ = { capabilities : { 16 this.state_ = {
17 iso : { min : 100.0, max : 12000.0, current : 400.0, step : 1.0 }, 17 capabilities: {
18 height : { min : 240.0, max : 2448.0, current : 240.0, step : 2.0 }, 18 supported_white_balance_modes: [
19 width : { min : 320.0, max : 3264.0, current : 320.0, step : 3.0 }, 19 imageCapture.MeteringMode.SINGLE_SHOT,
20 zoom : { min : 0.0, max : 10.0, current : 5.0, step : 5.0 }, 20 imageCapture.MeteringMode.CONTINUOUS
21 focus_mode : imageCapture.MeteringMode.MANUAL, 21 ],
22 exposure_mode : imageCapture.MeteringMode.SINGLE_SHOT, 22 current_white_balance_mode: imageCapture.MeteringMode.CONTINUOUS,
23 exposure_compensation : 23 supported_exposure_modes: [
24 { min : -200.0, max : 200.0, current : 33.0, step : 33.0}, 24 imageCapture.MeteringMode.SINGLE_SHOT,
25 white_balance_mode : imageCapture.MeteringMode.CONTINUOUS, 25 imageCapture.MeteringMode.CONTINUOUS
26 fill_light_mode : [ imageCapture.FillLightMode.AUTO, 26 ],
27 imageCapture.FillLightMode.FLASH], 27 current_exposure_mode: imageCapture.MeteringMode.SINGLE_SHOT,
28 red_eye_reduction : imageCapture.RedEyeReduction.CONTROLLABLE, 28 supported_focus_modes: [imageCapture.MeteringMode.MANUAL],
29 supports_torch : true, 29 current_focus_mode: imageCapture.MeteringMode.MANUAL,
30 torch : false, 30 points_of_interest: [{x: 0.4, y: 0.6}],
31 color_temperature : 31
32 { min : 2500.0, max : 6500.0, current : 6000.0, step : 1000.0 }, 32 exposure_compensation:
33 brightness : { min : 1.0, max : 10.0, current : 5.0, step : 1.0 }, 33 {min: -200.0, max: 200.0, current: 33.0, step: 33.0},
34 contrast : { min : 2.0, max : 9.0, current : 5.0, step : 1.0 }, 34 color_temperature:
35 saturation : { min : 3.0, max : 8.0, current : 6.0, step : 1.0 }, 35 {min: 2500.0, max: 6500.0, current: 6000.0, step: 1000.0},
36 sharpness : { min : 4.0, max : 7.0, current : 7.0, step : 1.0 }, 36 iso: {min: 100.0, max: 12000.0, current: 400.0, step: 1.0},
37 points_of_interest : [{x : 0.4, y : 0.6}], 37
38 }}; 38 brightness: {min: 1.0, max: 10.0, current: 5.0, step: 1.0},
39 contrast: {min: 2.0, max: 9.0, current: 5.0, step: 1.0},
40 saturation: {min: 3.0, max: 8.0, current: 6.0, step: 1.0},
41 sharpness: {min: 4.0, max: 7.0, current: 7.0, step: 1.0},
42
43 zoom: {min: 0.0, max: 10.0, current: 5.0, step: 5.0},
44
45 supports_torch: true,
46 torch: false,
47
48 red_eye_reduction: imageCapture.RedEyeReduction.CONTROLLABLE,
49 height: {min: 240.0, max: 2448.0, current: 240.0, step: 2.0},
50 width: {min: 320.0, max: 3264.0, current: 320.0, step: 3.0},
51 fill_light_mode: [
52 imageCapture.FillLightMode.AUTO, imageCapture.FillLightMode.FLASH
53 ],
54 }
55 };
39 this.settings_ = null; 56 this.settings_ = null;
40 this.bindingSet_ = new bindings.BindingSet(imageCapture.ImageCapture); 57 this.bindingSet_ = new bindings.BindingSet(imageCapture.ImageCapture);
41 } 58 }
42 59
43 getCapabilities(source_id) { 60 getCapabilities(source_id) {
44 return Promise.resolve(this.state_); 61 return Promise.resolve(this.state_);
45 } 62 }
46 63
47 setOptions(source_id, settings) { 64 setOptions(source_id, settings) {
48 this.settings_ = settings; 65 this.settings_ = settings;
49 if (settings.has_iso) 66 if (settings.has_iso)
50 this.state_.capabilities.iso.current = settings.iso; 67 this.state_.capabilities.iso.current = settings.iso;
51 if (settings.has_height) 68 if (settings.has_height)
52 this.state_.capabilities.height.current = settings.height; 69 this.state_.capabilities.height.current = settings.height;
53 if (settings.has_width) 70 if (settings.has_width)
54 this.state_.capabilities.width.current = settings.width; 71 this.state_.capabilities.width.current = settings.width;
55 if (settings.has_zoom) 72 if (settings.has_zoom)
56 this.state_.capabilities.zoom.current = settings.zoom; 73 this.state_.capabilities.zoom.current = settings.zoom;
57 if (settings.has_focus_mode) 74 if (settings.has_focus_mode)
58 this.state_.capabilities.focus_mode = settings.focus_mode; 75 this.state_.capabilities.current_focus_mode = settings.focus_mode;
59 76
60 if (settings.points_of_interest.length > 0) { 77 if (settings.points_of_interest.length > 0) {
61 this.state_.capabilities.points_of_interest = 78 this.state_.capabilities.points_of_interest =
62 settings.points_of_interest; 79 settings.points_of_interest;
63 } 80 }
64 81
65 if (settings.has_exposure_mode) 82 if (settings.has_exposure_mode)
66 this.state_.capabilities.exposure_mode = settings.exposure_mode; 83 this.state_.capabilities.current_exposure_mode = settings.exposure_mode;
67 84
68 if (settings.has_exposure_compensation) { 85 if (settings.has_exposure_compensation) {
69 this.state_.capabilities.exposure_compensation.current = 86 this.state_.capabilities.exposure_compensation.current =
70 settings.exposure_compensation; 87 settings.exposure_compensation;
71 } 88 }
72 if (settings.has_white_balance_mode) { 89 if (settings.has_white_balance_mode) {
73 this.state_.capabilities.white_balance_mode = 90 this.state_.capabilities.current_white_balance_mode =
74 settings.white_balance_mode; 91 settings.white_balance_mode;
75 } 92 }
76 if (settings.has_fill_light_mode) 93 if (settings.has_fill_light_mode)
77 this.state_.capabilities.fill_light_mode = [settings.fill_light_mode]; 94 this.state_.capabilities.fill_light_mode = [settings.fill_light_mode];
78 if (settings.has_red_eye_reduction) 95 if (settings.has_red_eye_reduction)
79 this.state_.capabilities.red_eye_reduction = settings.red_eye_reduction; 96 this.state_.capabilities.red_eye_reduction = settings.red_eye_reduction;
80 if (settings.has_color_temperature) { 97 if (settings.has_color_temperature) {
81 this.state_.capabilities.color_temperature.current = 98 this.state_.capabilities.color_temperature.current =
82 settings.color_temperature; 99 settings.color_temperature;
83 } 100 }
(...skipping 21 matching lines...) Expand all
105 return this.state_.capabilities; 122 return this.state_.capabilities;
106 } 123 }
107 124
108 options() { 125 options() {
109 return this.settings_; 126 return this.settings_;
110 } 127 }
111 128
112 } 129 }
113 return new MockImageCapture(); 130 return new MockImageCapture();
114 }); 131 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698