| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * An example empty pref. | 6 * An example empty pref. |
| 7 * @type {SiteSettingsPref} | 7 * @type {SiteSettingsPref} |
| 8 */ | 8 */ |
| 9 var prefsEmpty = { | 9 var prefsEmpty = { |
| 10 defaults: { | 10 defaults: { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 * specifying mock responses. | 43 * specifying mock responses. |
| 44 * | 44 * |
| 45 * @constructor | 45 * @constructor |
| 46 * @implements {settings.SiteSettingsPrefsBrowserProxy} | 46 * @implements {settings.SiteSettingsPrefsBrowserProxy} |
| 47 * @extends {settings.TestBrowserProxy} | 47 * @extends {settings.TestBrowserProxy} |
| 48 */ | 48 */ |
| 49 var TestSiteSettingsPrefsBrowserProxy = function() { | 49 var TestSiteSettingsPrefsBrowserProxy = function() { |
| 50 settings.TestBrowserProxy.call(this, [ | 50 settings.TestBrowserProxy.call(this, [ |
| 51 'fetchUsbDevices', | 51 'fetchUsbDevices', |
| 52 'fetchZoomLevels', | 52 'fetchZoomLevels', |
| 53 'fetchZoomScope', |
| 53 'getCookieDetails', | 54 'getCookieDetails', |
| 54 'getDefaultValueForContentType', | 55 'getDefaultValueForContentType', |
| 55 'getExceptionList', | 56 'getExceptionList', |
| 56 'observeProtocolHandlers', | 57 'observeProtocolHandlers', |
| 57 'observeProtocolHandlersEnabledState', | 58 'observeProtocolHandlersEnabledState', |
| 58 'reloadCookies', | 59 'reloadCookies', |
| 59 'removeCookie', | 60 'removeCookie', |
| 60 'removeProtocolHandler', | 61 'removeProtocolHandler', |
| 61 'removeUsbDevice', | 62 'removeUsbDevice', |
| 62 'removeZoomLevel', | 63 'removeZoomLevel', |
| 63 'resetCategoryPermissionForOrigin', | 64 'resetCategoryPermissionForOrigin', |
| 64 'setCategoryPermissionForOrigin', | 65 'setCategoryPermissionForOrigin', |
| 65 'setDefaultValueForContentType', | 66 'setDefaultValueForContentType', |
| 66 'setProtocolDefault' | 67 'setProtocolDefault', |
| 68 'setZoomScopeIsPerOrigin', |
| 67 ]); | 69 ]); |
| 68 | 70 |
| 69 /** @private {!SiteSettingsPref} */ | 71 /** @private {!SiteSettingsPref} */ |
| 70 this.prefs_ = prefsEmpty; | 72 this.prefs_ = prefsEmpty; |
| 71 | 73 |
| 74 /** @private {boolean} */ |
| 75 this.zoomScopeIsPerOrigin_ = true; |
| 76 |
| 72 /** @private {!Array<ZoomLevelEntry>} */ | 77 /** @private {!Array<ZoomLevelEntry>} */ |
| 73 this.zoomList_ = []; | 78 this.zoomList_ = []; |
| 74 | 79 |
| 75 /** @private {!Array<!UsbDeviceEntry>} */ | 80 /** @private {!Array<!UsbDeviceEntry>} */ |
| 76 this.usbDevices_ = []; | 81 this.usbDevices_ = []; |
| 77 | 82 |
| 78 /** @private {!Array<!ProtocolEntry>} */ | 83 /** @private {!Array<!ProtocolEntry>} */ |
| 79 this.protocolHandlers_ = []; | 84 this.protocolHandlers_ = []; |
| 80 | 85 |
| 81 /** @private {?CookieList} */ | 86 /** @private {?CookieList} */ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 96 for (var type in settings.ContentSettingsTypes) { | 101 for (var type in settings.ContentSettingsTypes) { |
| 97 cr.webUIListenerCallback( | 102 cr.webUIListenerCallback( |
| 98 'contentSettingSitePermissionChanged', | 103 'contentSettingSitePermissionChanged', |
| 99 settings.ContentSettingsTypes[type], | 104 settings.ContentSettingsTypes[type], |
| 100 ''); | 105 ''); |
| 101 } | 106 } |
| 102 }, | 107 }, |
| 103 | 108 |
| 104 /** | 109 /** |
| 105 * Sets the prefs to use when testing. | 110 * Sets the prefs to use when testing. |
| 111 * @param {boolean} zoomScopeIsPerOrigin The zoom scope to set. |
| 112 */ |
| 113 setZoomScope: function(zoomScopeIsPerOrigin) { |
| 114 this.zoomScopeIsPerOrigin_ = zoomScopeIsPerOrigin; |
| 115 }, |
| 116 |
| 117 /** |
| 118 * Sets the prefs to use when testing. |
| 106 * @param {!Array<ZoomLevelEntry>} list The zoom list to set. | 119 * @param {!Array<ZoomLevelEntry>} list The zoom list to set. |
| 107 */ | 120 */ |
| 108 setZoomList: function(list) { | 121 setZoomList: function(list) { |
| 109 this.zoomList_ = list; | 122 this.zoomList_ = list; |
| 110 }, | 123 }, |
| 111 | 124 |
| 112 /** | 125 /** |
| 113 * Sets the prefs to use when testing. | 126 * Sets the prefs to use when testing. |
| 114 * @param {!Array<UsbDeviceEntry>} list The usb device entry list to set. | 127 * @param {!Array<UsbDeviceEntry>} list The usb device entry list to set. |
| 115 */ | 128 */ |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 253 |
| 241 /** @override */ | 254 /** @override */ |
| 242 setCategoryPermissionForOrigin: function( | 255 setCategoryPermissionForOrigin: function( |
| 243 primaryPattern, secondaryPattern, contentType, value, incognito) { | 256 primaryPattern, secondaryPattern, contentType, value, incognito) { |
| 244 this.methodCalled('setCategoryPermissionForOrigin', | 257 this.methodCalled('setCategoryPermissionForOrigin', |
| 245 [primaryPattern, secondaryPattern, contentType, value]); | 258 [primaryPattern, secondaryPattern, contentType, value]); |
| 246 return Promise.resolve(); | 259 return Promise.resolve(); |
| 247 }, | 260 }, |
| 248 | 261 |
| 249 /** @override */ | 262 /** @override */ |
| 263 fetchZoomScope: function() { |
| 264 cr.webUIListenerCallback('onZoomScopeChanged', this.zoomScopeIsPerOrigin_); |
| 265 this.methodCalled('fetchZoomScope'); |
| 266 }, |
| 267 |
| 268 /** @override */ |
| 250 fetchZoomLevels: function() { | 269 fetchZoomLevels: function() { |
| 251 cr.webUIListenerCallback('onZoomLevelsChanged', this.zoomList_); | 270 cr.webUIListenerCallback('onZoomLevelsChanged', this.zoomList_); |
| 252 this.methodCalled('fetchZoomLevels'); | 271 this.methodCalled('fetchZoomLevels'); |
| 253 }, | 272 }, |
| 254 | 273 |
| 255 /** @override */ | 274 /** @override */ |
| 256 reloadCookies: function() { | 275 reloadCookies: function() { |
| 257 return Promise.resolve({id: null, children: []}); | 276 return Promise.resolve({id: null, children: []}); |
| 258 }, | 277 }, |
| 259 | 278 |
| 260 /** @override */ | 279 /** @override */ |
| 261 removeCookie: function(path) { | 280 removeCookie: function(path) { |
| 262 this.methodCalled('removeCookie', path); | 281 this.methodCalled('removeCookie', path); |
| 263 }, | 282 }, |
| 264 | 283 |
| 265 /** @override */ | 284 /** @override */ |
| 285 setZoomScopeIsPerOrigin: function(zoomScopeIsPerOrigin) { |
| 286 this.methodCalled('setZoomScopeIsPerOrigin', [zoomScopeIsPerOrigin]); |
| 287 }, |
| 288 |
| 289 /** @override */ |
| 266 removeZoomLevel: function(host) { | 290 removeZoomLevel: function(host) { |
| 267 this.methodCalled('removeZoomLevel', [host]); | 291 this.methodCalled('removeZoomLevel', [host]); |
| 268 }, | 292 }, |
| 269 | 293 |
| 270 /** @override */ | 294 /** @override */ |
| 271 fetchUsbDevices: function() { | 295 fetchUsbDevices: function() { |
| 272 this.methodCalled('fetchUsbDevices'); | 296 this.methodCalled('fetchUsbDevices'); |
| 273 return Promise.resolve(this.usbDevices_); | 297 return Promise.resolve(this.usbDevices_); |
| 274 }, | 298 }, |
| 275 | 299 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 294 /** @override */ | 318 /** @override */ |
| 295 setProtocolDefault: function() { | 319 setProtocolDefault: function() { |
| 296 this.methodCalled('setProtocolDefault', arguments); | 320 this.methodCalled('setProtocolDefault', arguments); |
| 297 }, | 321 }, |
| 298 | 322 |
| 299 /** @override */ | 323 /** @override */ |
| 300 removeProtocolHandler: function() { | 324 removeProtocolHandler: function() { |
| 301 this.methodCalled('removeProtocolHandler', arguments); | 325 this.methodCalled('removeProtocolHandler', arguments); |
| 302 } | 326 } |
| 303 }; | 327 }; |
| OLD | NEW |