| 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: { |
| 11 auto_downloads: '', | 11 auto_downloads: '', |
| 12 background_sync: '', | 12 background_sync: '', |
| 13 camera: '', | 13 camera: '', |
| 14 cookies: '', | 14 cookies: '', |
| 15 geolocation: '', | 15 geolocation: '', |
| 16 javascript: '', | 16 javascript: '', |
| 17 mic: '', | 17 mic: '', |
| 18 midiDevices: '', | 18 midiDevices: '', |
| 19 notifications: '', | 19 notifications: '', |
| 20 plugins: '', | 20 plugins: '', |
| 21 popups: '', | 21 popups: '', |
| 22 subresource_filter: '', |
| 22 unsandboxed_plugins: '', | 23 unsandboxed_plugins: '', |
| 23 }, | 24 }, |
| 24 exceptions: { | 25 exceptions: { |
| 25 auto_downloads: [], | 26 auto_downloads: [], |
| 26 background_sync: [], | 27 background_sync: [], |
| 27 camera: [], | 28 camera: [], |
| 28 cookies: [], | 29 cookies: [], |
| 29 geolocation: [], | 30 geolocation: [], |
| 30 javascript: [], | 31 javascript: [], |
| 31 mic: [], | 32 mic: [], |
| 32 midiDevices: [], | 33 midiDevices: [], |
| 33 notifications: [], | 34 notifications: [], |
| 34 plugins: [], | 35 plugins: [], |
| 35 popups: [], | 36 popups: [], |
| 37 subresource_filter: [], |
| 36 unsandboxed_plugins: [], | 38 unsandboxed_plugins: [], |
| 37 }, | 39 }, |
| 38 }; | 40 }; |
| 39 | 41 |
| 40 /** | 42 /** |
| 41 * A test version of SiteSettingsPrefsBrowserProxy. Provides helper methods | 43 * A test version of SiteSettingsPrefsBrowserProxy. Provides helper methods |
| 42 * for allowing tests to know when a method was called, as well as | 44 * for allowing tests to know when a method was called, as well as |
| 43 * specifying mock responses. | 45 * specifying mock responses. |
| 44 * | 46 * |
| 45 * @constructor | 47 * @constructor |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 pref = this.prefs_.defaults.notifications; | 179 pref = this.prefs_.defaults.notifications; |
| 178 } else if (contentType == settings.ContentSettingsTypes.PDF_DOCUMENTS) { | 180 } else if (contentType == settings.ContentSettingsTypes.PDF_DOCUMENTS) { |
| 179 pref = this.prefs_.defaults.pdf_documents; | 181 pref = this.prefs_.defaults.pdf_documents; |
| 180 } else if (contentType == settings.ContentSettingsTypes.POPUPS) { | 182 } else if (contentType == settings.ContentSettingsTypes.POPUPS) { |
| 181 pref = this.prefs_.defaults.popups; | 183 pref = this.prefs_.defaults.popups; |
| 182 } else if (contentType == settings.ContentSettingsTypes.PLUGINS) { | 184 } else if (contentType == settings.ContentSettingsTypes.PLUGINS) { |
| 183 pref = this.prefs_.defaults.plugins; | 185 pref = this.prefs_.defaults.plugins; |
| 184 } else if ( | 186 } else if ( |
| 185 contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) { | 187 contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) { |
| 186 pref = this.prefs_.defaults.unsandboxed_plugins; | 188 pref = this.prefs_.defaults.unsandboxed_plugins; |
| 189 } |
| 190 else if (contentType == settings.ContentSettingsTypes.SUBRESOURCE_FILTER) { |
| 191 pref = this.prefs_.defaults.subresource_filter; |
| 187 } else { | 192 } else { |
| 188 console.log('getDefault received unknown category: ' + contentType); | 193 console.log('getDefault received unknown category: ' + contentType); |
| 189 } | 194 } |
| 190 | 195 |
| 191 assert(pref != undefined, 'Pref is missing for ' + contentType); | 196 assert(pref != undefined, 'Pref is missing for ' + contentType); |
| 192 return Promise.resolve(pref); | 197 return Promise.resolve(pref); |
| 193 }, | 198 }, |
| 194 | 199 |
| 195 /** @override */ | 200 /** @override */ |
| 196 getExceptionList: function(contentType) { | 201 getExceptionList: function(contentType) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 220 else if (contentType == settings.ContentSettingsTypes.PDF_DOCUMENTS) | 225 else if (contentType == settings.ContentSettingsTypes.PDF_DOCUMENTS) |
| 221 pref = this.prefs_.exceptions.pdf_documents; | 226 pref = this.prefs_.exceptions.pdf_documents; |
| 222 else if (contentType == settings.ContentSettingsTypes.PLUGINS) | 227 else if (contentType == settings.ContentSettingsTypes.PLUGINS) |
| 223 pref = this.prefs_.exceptions.plugins; | 228 pref = this.prefs_.exceptions.plugins; |
| 224 else if (contentType == settings.ContentSettingsTypes.PROTECTED_CONTENT) | 229 else if (contentType == settings.ContentSettingsTypes.PROTECTED_CONTENT) |
| 225 pref = this.prefs_.exceptions.protectedContent; | 230 pref = this.prefs_.exceptions.protectedContent; |
| 226 else if (contentType == settings.ContentSettingsTypes.POPUPS) | 231 else if (contentType == settings.ContentSettingsTypes.POPUPS) |
| 227 pref = this.prefs_.exceptions.popups; | 232 pref = this.prefs_.exceptions.popups; |
| 228 else if (contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) | 233 else if (contentType == settings.ContentSettingsTypes.UNSANDBOXED_PLUGINS) |
| 229 pref = this.prefs_.exceptions.unsandboxed_plugins; | 234 pref = this.prefs_.exceptions.unsandboxed_plugins; |
| 235 else if (contentType == settings.ContentSettingsTypes.SUBRESOURCE_FILTER) { |
| 236 pref = this.prefs_.exceptions.subresource_filter; |
| 237 } |
| 230 else | 238 else |
| 231 console.log('getExceptionList received unknown category: ' + contentType); | 239 console.log('getExceptionList received unknown category: ' + contentType); |
| 232 | 240 |
| 233 assert(pref != undefined, 'Pref is missing for ' + contentType); | 241 assert(pref != undefined, 'Pref is missing for ' + contentType); |
| 234 return Promise.resolve(pref); | 242 return Promise.resolve(pref); |
| 235 }, | 243 }, |
| 236 | 244 |
| 237 /** @override */ | 245 /** @override */ |
| 238 isPatternValid: function(pattern) { | 246 isPatternValid: function(pattern) { |
| 239 this.methodCalled('isPatternValid', pattern); | 247 this.methodCalled('isPatternValid', pattern); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 /** @override */ | 319 /** @override */ |
| 312 setProtocolDefault: function() { | 320 setProtocolDefault: function() { |
| 313 this.methodCalled('setProtocolDefault', arguments); | 321 this.methodCalled('setProtocolDefault', arguments); |
| 314 }, | 322 }, |
| 315 | 323 |
| 316 /** @override */ | 324 /** @override */ |
| 317 removeProtocolHandler: function() { | 325 removeProtocolHandler: function() { |
| 318 this.methodCalled('removeProtocolHandler', arguments); | 326 this.methodCalled('removeProtocolHandler', arguments); |
| 319 } | 327 } |
| 320 }; | 328 }; |
| OLD | NEW |