| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 'getCookieDetails', | 53 'getCookieDetails', |
| 54 'getDefaultValueForContentType', | 54 'getDefaultValueForContentType', |
| 55 'getExceptionList', | 55 'getExceptionList', |
| 56 'isPatternValid', |
| 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' |
| 67 ]); | 68 ]); |
| 68 | 69 |
| 69 /** @private {!SiteSettingsPref} */ | 70 /** @private {!SiteSettingsPref} */ |
| 70 this.prefs_ = prefsEmpty; | 71 this.prefs_ = prefsEmpty; |
| 71 | 72 |
| 72 /** @private {!Array<ZoomLevelEntry>} */ | 73 /** @private {!Array<ZoomLevelEntry>} */ |
| 73 this.zoomList_ = []; | 74 this.zoomList_ = []; |
| 74 | 75 |
| 75 /** @private {!Array<!UsbDeviceEntry>} */ | 76 /** @private {!Array<!UsbDeviceEntry>} */ |
| 76 this.usbDevices_ = []; | 77 this.usbDevices_ = []; |
| 77 | 78 |
| 78 /** @private {!Array<!ProtocolEntry>} */ | 79 /** @private {!Array<!ProtocolEntry>} */ |
| 79 this.protocolHandlers_ = []; | 80 this.protocolHandlers_ = []; |
| 80 | 81 |
| 81 /** @private {?CookieList} */ | 82 /** @private {?CookieList} */ |
| 82 this.cookieDetails_ = null; | 83 this.cookieDetails_ = null; |
| 84 |
| 85 /** @private {boolean} */ |
| 86 this.isPatternValid_ = true; |
| 83 }; | 87 }; |
| 84 | 88 |
| 85 TestSiteSettingsPrefsBrowserProxy.prototype = { | 89 TestSiteSettingsPrefsBrowserProxy.prototype = { |
| 86 __proto__: settings.TestBrowserProxy.prototype, | 90 __proto__: settings.TestBrowserProxy.prototype, |
| 87 | 91 |
| 88 /** | 92 /** |
| 89 * Sets the prefs to use when testing. | 93 * Sets the prefs to use when testing. |
| 90 * @param {!SiteSettingsPref} prefs The prefs to set. | 94 * @param {!SiteSettingsPref} prefs The prefs to set. |
| 91 */ | 95 */ |
| 92 setPrefs: function(prefs) { | 96 setPrefs: function(prefs) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 else if (contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) | 228 else if (contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) |
| 225 pref = this.prefs_.exceptions.unsandboxed_plugins; | 229 pref = this.prefs_.exceptions.unsandboxed_plugins; |
| 226 else | 230 else |
| 227 console.log('getExceptionList received unknown category: ' + contentType); | 231 console.log('getExceptionList received unknown category: ' + contentType); |
| 228 | 232 |
| 229 assert(pref != undefined, 'Pref is missing for ' + contentType); | 233 assert(pref != undefined, 'Pref is missing for ' + contentType); |
| 230 return Promise.resolve(pref); | 234 return Promise.resolve(pref); |
| 231 }, | 235 }, |
| 232 | 236 |
| 233 /** @override */ | 237 /** @override */ |
| 238 isPatternValid: function(pattern) { |
| 239 this.methodCalled('isPatternValid', pattern); |
| 240 return Promise.resolve(this.isPatternValid_); |
| 241 }, |
| 242 |
| 243 /** |
| 244 * Specify whether isPatternValid should succeed or fail. |
| 245 */ |
| 246 setIsPatternValid: function(isValid) { |
| 247 this.isPatternValid_ = isValid; |
| 248 }, |
| 249 |
| 250 /** @override */ |
| 234 resetCategoryPermissionForOrigin: function( | 251 resetCategoryPermissionForOrigin: function( |
| 235 primaryPattern, secondaryPattern, contentType, incognito) { | 252 primaryPattern, secondaryPattern, contentType, incognito) { |
| 236 this.methodCalled('resetCategoryPermissionForOrigin', | 253 this.methodCalled('resetCategoryPermissionForOrigin', |
| 237 [primaryPattern, secondaryPattern, contentType, incognito]); | 254 [primaryPattern, secondaryPattern, contentType, incognito]); |
| 238 return Promise.resolve(); | 255 return Promise.resolve(); |
| 239 }, | 256 }, |
| 240 | 257 |
| 241 /** @override */ | 258 /** @override */ |
| 242 setCategoryPermissionForOrigin: function( | 259 setCategoryPermissionForOrigin: function( |
| 243 primaryPattern, secondaryPattern, contentType, value, incognito) { | 260 primaryPattern, secondaryPattern, contentType, value, incognito) { |
| 244 this.methodCalled('setCategoryPermissionForOrigin', | 261 this.methodCalled('setCategoryPermissionForOrigin', |
| 245 [primaryPattern, secondaryPattern, contentType, value]); | 262 [primaryPattern, secondaryPattern, contentType, value, incognito]); |
| 246 return Promise.resolve(); | 263 return Promise.resolve(); |
| 247 }, | 264 }, |
| 248 | 265 |
| 249 /** @override */ | 266 /** @override */ |
| 250 fetchZoomLevels: function() { | 267 fetchZoomLevels: function() { |
| 251 cr.webUIListenerCallback('onZoomLevelsChanged', this.zoomList_); | 268 cr.webUIListenerCallback('onZoomLevelsChanged', this.zoomList_); |
| 252 this.methodCalled('fetchZoomLevels'); | 269 this.methodCalled('fetchZoomLevels'); |
| 253 }, | 270 }, |
| 254 | 271 |
| 255 /** @override */ | 272 /** @override */ |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 /** @override */ | 311 /** @override */ |
| 295 setProtocolDefault: function() { | 312 setProtocolDefault: function() { |
| 296 this.methodCalled('setProtocolDefault', arguments); | 313 this.methodCalled('setProtocolDefault', arguments); |
| 297 }, | 314 }, |
| 298 | 315 |
| 299 /** @override */ | 316 /** @override */ |
| 300 removeProtocolHandler: function() { | 317 removeProtocolHandler: function() { |
| 301 this.methodCalled('removeProtocolHandler', arguments); | 318 this.methodCalled('removeProtocolHandler', arguments); |
| 302 } | 319 } |
| 303 }; | 320 }; |
| OLD | NEW |