Chromium Code Reviews| Index: chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js |
| diff --git a/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js b/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js |
| index 2f4f8eb157c351b0773431c78d08d02d9614d173..7f979d67d50f5ca4630743a865d5c3d35ef44178 100644 |
| --- a/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js |
| +++ b/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js |
| @@ -50,9 +50,11 @@ var prefsEmpty = { |
| */ |
| var TestSiteSettingsPrefsBrowserProxy = function() { |
| settings.TestBrowserProxy.call(this, [ |
| + 'fetchUsbDevices', |
| 'fetchZoomLevels', |
| 'getDefaultValueForContentType', |
| 'getExceptionList', |
| + 'removeUsbDevice', |
| 'removeZoomLevel', |
| 'resetCategoryPermissionForOrigin', |
| 'setCategoryPermissionForOrigin', |
| @@ -64,6 +66,9 @@ var TestSiteSettingsPrefsBrowserProxy = function() { |
| /** @private {!Array<ZoomLevelEntry>} */ |
| this.zoomList_ = []; |
| + |
| + /** @private {!Array<UsbDeviceEntry>} */ |
| + this.usbDevices_ = []; |
| }; |
| TestSiteSettingsPrefsBrowserProxy.prototype = { |
| @@ -93,6 +98,15 @@ TestSiteSettingsPrefsBrowserProxy.prototype = { |
| this.zoomList_ = list; |
| }, |
| + /** |
| + * Sets the prefs to use when testing. |
| + * @param !Array<UsbDeviceEntry> list The usb device entry list to set. |
|
dschuyler
2016/11/08 01:48:41
The @param type should be in {}, like this:
* @pa
scottchen
2016/11/09 19:20:56
Done.
|
| + */ |
| + setUsbDevices: function(list) { |
| + // Shallow copy of the passed-in array so mutation won't impact the source |
| + this.usbDevices_ = list.slice(); |
| + }, |
| + |
| /** @override */ |
| setDefaultValueForContentType: function(contentType, defaultValue) { |
| this.methodCalled( |
| @@ -207,4 +221,22 @@ TestSiteSettingsPrefsBrowserProxy.prototype = { |
| removeZoomLevel: function(host) { |
| this.methodCalled('removeZoomLevel', [host]); |
| }, |
| + |
| + /** @override */ |
| + fetchUsbDevices: function() { |
| + this.methodCalled('fetchUsbDevices'); |
| + return Promise.resolve(this.usbDevices_); |
| + }, |
| + |
| + removeUsbDevice: function(origin, embeddingOrigin, object) { |
|
dschuyler
2016/11/08 01:48:41
@param for each parameter.
dpapad
2016/11/08 01:53:49
Why do you need to have any logic inside here?
scottchen
2016/11/09 19:20:56
The intention was to mimic the expected remove log
scottchen
2016/11/09 19:20:56
Acknowledged.
|
| + for(var i = 0; i < this.usbDevices_.length; i++) { |
| + var device = this.usbDevices_[i]; |
| + if(device.origin === origin |
| + && device.embeddingOrigin === embeddingOrigin |
| + && device.object === object) { |
| + this.usbDevices_.splice(i, 1); |
| + break; |
| + } |
| + } |
| + } |
| }; |