| 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 { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 this.settings_ = null; | 35 this.settings_ = null; |
| 36 this.bindingSet_ = new bindings.BindingSet(imageCapture.ImageCapture); | 36 this.bindingSet_ = new bindings.BindingSet(imageCapture.ImageCapture); |
| 37 } | 37 } |
| 38 | 38 |
| 39 getCapabilities(source_id) { | 39 getCapabilities(source_id) { |
| 40 return Promise.resolve(this.capabilities_); | 40 return Promise.resolve(this.capabilities_); |
| 41 } | 41 } |
| 42 | 42 |
| 43 setOptions(source_id, settings) { | 43 setOptions(source_id, settings) { |
| 44 this.settings_ = settings; | 44 this.settings_ = settings; |
| 45 if (settings.has_iso) |
| 46 this.capabilities_.capabilities.iso.current = settings.iso; |
| 47 if (settings.has_height) |
| 48 this.capabilities_.capabilities.height.current = settings.height; |
| 49 if (settings.has_width) |
| 50 this.capabilities_.capabilities.width.current = settings.width; |
| 51 if (settings.has_zoom) |
| 52 this.capabilities_.capabilities.zoom.current = settings.zoom; |
| 53 if (settings.has_focus_mode) { |
| 54 this.capabilities_.capabilities.focus_mode = |
| 55 settings.focus_mode; |
| 56 } |
| 57 if (settings.has_exposure_mode) { |
| 58 this.capabilities_.capabilities.exposure_mode = |
| 59 settings.exposure_mode; |
| 60 } |
| 61 if (settings.has_exposure_compensation) { |
| 62 this.capabilities_.capabilities.exposure_compensation.current = |
| 63 settings.exposure_compensation; |
| 64 } |
| 65 if (settings.has_white_balance_mode) { |
| 66 this.capabilities_.capabilities.white_balance_mode = |
| 67 settings.white_balance_mode; |
| 68 } |
| 69 if (settings.has_fill_light_mode) { |
| 70 this.capabilities_.capabilities.fill_light_mode = |
| 71 settings.fill_light_mode; |
| 72 } |
| 73 if (settings.has_red_eye_reduction) { |
| 74 this.capabilities_.capabilities.red_eye_reduction = |
| 75 settings.red_eye_reduction; |
| 76 } |
| 77 if (settings.has_color_temperature) { |
| 78 this.capabilities_.capabilities.color_temperature.current = |
| 79 settings.color_temperature; |
| 80 } |
| 81 if (settings.has_brightness) |
| 82 this.capabilities_.capabilities.brightness.current = settings.brightness
; |
| 83 if (settings.has_contrast) |
| 84 this.capabilities_.capabilities.contrast.current = settings.contrast; |
| 85 if (settings.has_saturation) { |
| 86 this.capabilities_.capabilities.saturation.current = |
| 87 settings.saturation; |
| 88 } |
| 89 if (settings.has_sharpness) |
| 90 this.capabilities_.capabilities.sharpness.current = settings.sharpness; |
| 91 |
| 45 return Promise.resolve({ success : true }); | 92 return Promise.resolve({ success : true }); |
| 46 } | 93 } |
| 47 | 94 |
| 48 takePhoto(source_id) { | 95 takePhoto(source_id) { |
| 49 return Promise.resolve({ blob : { mime_type : 'image/cat', | 96 return Promise.resolve({ blob : { mime_type : 'image/cat', |
| 50 data : new Array(2) } }); | 97 data : new Array(2) } }); |
| 51 } | 98 } |
| 52 | 99 |
| 53 capabilities() { | 100 capabilities() { |
| 54 return this.capabilities_.capabilities; | 101 return this.capabilities_.capabilities; |
| 55 } | 102 } |
| 56 | 103 |
| 57 options() { | 104 options() { |
| 58 return this.settings_; | 105 return this.settings_; |
| 59 } | 106 } |
| 60 | 107 |
| 61 } | 108 } |
| 62 return new MockImageCapture(); | 109 return new MockImageCapture(); |
| 63 }); | 110 }); |
| OLD | NEW |