| OLD | NEW |
| 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_ = { capabilities : { |
| 17 iso : { min : 100.0, max : 12000.0, current : 400.0, step : 1.0 }, | 17 iso : { min : 100.0, max : 12000.0, current : 400.0, step : 1.0 }, |
| 18 height : { min : 240.0, max : 2448.0, current : 240.0, step : 2.0 }, | 18 height : { min : 240.0, max : 2448.0, current : 240.0, step : 2.0 }, |
| 19 width : { min : 320.0, max : 3264.0, current : 320.0, step : 3.0 }, | 19 width : { min : 320.0, max : 3264.0, current : 320.0, step : 3.0 }, |
| 20 zoom : { min : 0.0, max : 10.0, current : 5.0, step : 5.0 }, | 20 zoom : { min : 0.0, max : 10.0, current : 5.0, step : 5.0 }, |
| 21 focus_mode : imageCapture.MeteringMode.MANUAL, | 21 focus_mode : imageCapture.MeteringMode.MANUAL, |
| 22 exposure_mode : imageCapture.MeteringMode.SINGLE_SHOT, | 22 exposure_mode : imageCapture.MeteringMode.SINGLE_SHOT, |
| 23 exposure_compensation : | 23 exposure_compensation : |
| 24 { min : -200.0, max : 200.0, current : 33.0, step : 33.0}, | 24 { min : -200.0, max : 200.0, current : 33.0, step : 33.0}, |
| 25 white_balance_mode : imageCapture.MeteringMode.CONTINUOUS, | 25 white_balance_mode : imageCapture.MeteringMode.CONTINUOUS, |
| 26 fill_light_mode : imageCapture.FillLightMode.AUTO, | 26 fill_light_mode : [ imageCapture.FillLightMode.AUTO, |
| 27 red_eye_reduction : true, | 27 imageCapture.FillLightMode.FLASH], |
| 28 red_eye_reduction : imageCapture.RedEyeReduction.CONTROLLABLE, |
| 29 torch : false, |
| 28 color_temperature : | 30 color_temperature : |
| 29 { min : 2500.0, max : 6500.0, current : 6000.0, step : 1000.0 }, | 31 { min : 2500.0, max : 6500.0, current : 6000.0, step : 1000.0 }, |
| 30 brightness : { min : 1.0, max : 10.0, current : 5.0, step : 1.0 }, | 32 brightness : { min : 1.0, max : 10.0, current : 5.0, step : 1.0 }, |
| 31 contrast : { min : 2.0, max : 9.0, current : 5.0, step : 1.0 }, | 33 contrast : { min : 2.0, max : 9.0, current : 5.0, step : 1.0 }, |
| 32 saturation : { min : 3.0, max : 8.0, current : 6.0, step : 1.0 }, | 34 saturation : { min : 3.0, max : 8.0, current : 6.0, step : 1.0 }, |
| 33 sharpness : { min : 4.0, max : 7.0, current : 7.0, step : 1.0 }, | 35 sharpness : { min : 4.0, max : 7.0, current : 7.0, step : 1.0 }, |
| 34 points_of_interest : [], | 36 points_of_interest : [], |
| 35 }}; | 37 }}; |
| 36 this.settings_ = null; | 38 this.settings_ = null; |
| 37 this.bindingSet_ = new bindings.BindingSet(imageCapture.ImageCapture); | 39 this.bindingSet_ = new bindings.BindingSet(imageCapture.ImageCapture); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 64 | 66 |
| 65 if (settings.has_exposure_compensation) { | 67 if (settings.has_exposure_compensation) { |
| 66 this.state_.capabilities.exposure_compensation.current = | 68 this.state_.capabilities.exposure_compensation.current = |
| 67 settings.exposure_compensation; | 69 settings.exposure_compensation; |
| 68 } | 70 } |
| 69 if (settings.has_white_balance_mode) { | 71 if (settings.has_white_balance_mode) { |
| 70 this.state_.capabilities.white_balance_mode = | 72 this.state_.capabilities.white_balance_mode = |
| 71 settings.white_balance_mode; | 73 settings.white_balance_mode; |
| 72 } | 74 } |
| 73 if (settings.has_fill_light_mode) | 75 if (settings.has_fill_light_mode) |
| 74 this.state_.capabilities.fill_light_mode = settings.fill_light_mode; | 76 this.state_.capabilities.fill_light_mode = [settings.fill_light_mode]; |
| 75 if (settings.has_red_eye_reduction) | 77 if (settings.has_red_eye_reduction) |
| 76 this.state_.capabilities.red_eye_reduction = settings.red_eye_reduction; | 78 this.state_.capabilities.red_eye_reduction = settings.red_eye_reduction; |
| 77 if (settings.has_color_temperature) { | 79 if (settings.has_color_temperature) { |
| 78 this.state_.capabilities.color_temperature.current = | 80 this.state_.capabilities.color_temperature.current = |
| 79 settings.color_temperature; | 81 settings.color_temperature; |
| 80 } | 82 } |
| 81 if (settings.has_brightness) | 83 if (settings.has_brightness) |
| 82 this.state_.capabilities.brightness.current = settings.brightness; | 84 this.state_.capabilities.brightness.current = settings.brightness; |
| 83 if (settings.has_contrast) | 85 if (settings.has_contrast) |
| 84 this.state_.capabilities.contrast.current = settings.contrast; | 86 this.state_.capabilities.contrast.current = settings.contrast; |
| 85 if (settings.has_saturation) | 87 if (settings.has_saturation) |
| 86 this.state_.capabilities.saturation.current = settings.saturation; | 88 this.state_.capabilities.saturation.current = settings.saturation; |
| 87 if (settings.has_sharpness) | 89 if (settings.has_sharpness) |
| 88 this.state_.capabilities.sharpness.current = settings.sharpness; | 90 this.state_.capabilities.sharpness.current = settings.sharpness; |
| 89 | 91 |
| 92 if (settings.has_torch) |
| 93 this.state_.capabilities.torch = settings.torch; |
| 94 |
| 90 return Promise.resolve({ success : true }); | 95 return Promise.resolve({ success : true }); |
| 91 } | 96 } |
| 92 | 97 |
| 93 takePhoto(source_id) { | 98 takePhoto(source_id) { |
| 94 return Promise.resolve({ blob : { mime_type : 'image/cat', | 99 return Promise.resolve({ blob : { mime_type : 'image/cat', |
| 95 data : new Array(2) } }); | 100 data : new Array(2) } }); |
| 96 } | 101 } |
| 97 | 102 |
| 98 capabilities() { | 103 capabilities() { |
| 99 return this.state_.capabilities; | 104 return this.state_.capabilities; |
| 100 } | 105 } |
| 101 | 106 |
| 102 options() { | 107 options() { |
| 103 return this.settings_; | 108 return this.settings_; |
| 104 } | 109 } |
| 105 | 110 |
| 106 } | 111 } |
| 107 return new MockImageCapture(); | 112 return new MockImageCapture(); |
| 108 }); | 113 }); |
| OLD | NEW |