Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js

Issue 2687553003: MD Settings: Fix site data details regression and add test. (Closed)
Patch Set: Address comments. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 * specifying mock responses. 41 * specifying mock responses.
42 * 42 *
43 * @constructor 43 * @constructor
44 * @implements {settings.SiteSettingsPrefsBrowserProxy} 44 * @implements {settings.SiteSettingsPrefsBrowserProxy}
45 * @extends {settings.TestBrowserProxy} 45 * @extends {settings.TestBrowserProxy}
46 */ 46 */
47 var TestSiteSettingsPrefsBrowserProxy = function() { 47 var TestSiteSettingsPrefsBrowserProxy = function() {
48 settings.TestBrowserProxy.call(this, [ 48 settings.TestBrowserProxy.call(this, [
49 'fetchUsbDevices', 49 'fetchUsbDevices',
50 'fetchZoomLevels', 50 'fetchZoomLevels',
51 'getCookieDetails',
51 'getDefaultValueForContentType', 52 'getDefaultValueForContentType',
52 'getExceptionList', 53 'getExceptionList',
53 'observeProtocolHandlers', 54 'observeProtocolHandlers',
54 'observeProtocolHandlersEnabledState', 55 'observeProtocolHandlersEnabledState',
55 'removeProtocolHandler', 56 'removeProtocolHandler',
56 'removeUsbDevice', 57 'removeUsbDevice',
57 'removeZoomLevel', 58 'removeZoomLevel',
58 'resetCategoryPermissionForOrigin', 59 'resetCategoryPermissionForOrigin',
59 'setCategoryPermissionForOrigin', 60 'setCategoryPermissionForOrigin',
60 'setDefaultValueForContentType', 61 'setDefaultValueForContentType',
61 'setProtocolDefault' 62 'setProtocolDefault'
62 ]); 63 ]);
63 64
64 /** @private {!SiteSettingsPref} */ 65 /** @private {!SiteSettingsPref} */
65 this.prefs_ = prefsEmpty; 66 this.prefs_ = prefsEmpty;
66 67
67 /** @private {!Array<ZoomLevelEntry>} */ 68 /** @private {!Array<ZoomLevelEntry>} */
68 this.zoomList_ = []; 69 this.zoomList_ = [];
69 70
70 /** @private {!Array<!UsbDeviceEntry>} */ 71 /** @private {!Array<!UsbDeviceEntry>} */
71 this.usbDevices_ = []; 72 this.usbDevices_ = [];
72 73
73 /** @private {!Array<!ProtocolEntry>} */ 74 /** @private {!Array<!ProtocolEntry>} */
74 this.protocolHandlers_ = []; 75 this.protocolHandlers_ = [];
76
77 /** @private {?CookieList} */
78 this.cookieDetails_ = null;
75 }; 79 };
76 80
77 TestSiteSettingsPrefsBrowserProxy.prototype = { 81 TestSiteSettingsPrefsBrowserProxy.prototype = {
78 __proto__: settings.TestBrowserProxy.prototype, 82 __proto__: settings.TestBrowserProxy.prototype,
79 83
80 /** 84 /**
81 * Sets the prefs to use when testing. 85 * Sets the prefs to use when testing.
82 * @param {!SiteSettingsPref} prefs The prefs to set. 86 * @param {!SiteSettingsPref} prefs The prefs to set.
83 */ 87 */
84 setPrefs: function(prefs) { 88 setPrefs: function(prefs) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 this.protocolHandlers_ = list.slice(); 123 this.protocolHandlers_ = list.slice();
120 }, 124 },
121 125
122 /** @override */ 126 /** @override */
123 setDefaultValueForContentType: function(contentType, defaultValue) { 127 setDefaultValueForContentType: function(contentType, defaultValue) {
124 this.methodCalled( 128 this.methodCalled(
125 'setDefaultValueForContentType', [contentType, defaultValue]); 129 'setDefaultValueForContentType', [contentType, defaultValue]);
126 }, 130 },
127 131
128 /** @override */ 132 /** @override */
133 getCookieDetails: function(site) {
134 this.methodCalled('getCookieDetails', site);
135 return Promise.resolve(this.cookieDetails_ || {id: '', children: []});
136 },
137
138 /**
139 * @param {!CookieList} cookieList
140 */
141 setCookieDetails: function(cookieList) {
142 this.cookieDetails_ = cookieList;
143 },
144
145 /** @override */
129 getDefaultValueForContentType: function(contentType) { 146 getDefaultValueForContentType: function(contentType) {
130 this.methodCalled('getDefaultValueForContentType', contentType); 147 this.methodCalled('getDefaultValueForContentType', contentType);
131 148
132 var pref = undefined; 149 var pref = undefined;
133 if (contentType == settings.ContentSettingsTypes.AUTOMATIC_DOWNLOADS) { 150 if (contentType == settings.ContentSettingsTypes.AUTOMATIC_DOWNLOADS) {
134 pref = this.prefs_.defaults.auto_downloads; 151 pref = this.prefs_.defaults.auto_downloads;
135 } else if (contentType == settings.ContentSettingsTypes.BACKGROUND_SYNC) { 152 } else if (contentType == settings.ContentSettingsTypes.BACKGROUND_SYNC) {
136 pref = this.prefs_.background_sync; 153 pref = this.prefs_.background_sync;
137 } else if (contentType == settings.ContentSettingsTypes.CAMERA) { 154 } else if (contentType == settings.ContentSettingsTypes.CAMERA) {
138 pref = this.prefs_.defaults.camera; 155 pref = this.prefs_.defaults.camera;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 /** @override */ 274 /** @override */
258 setProtocolDefault: function() { 275 setProtocolDefault: function() {
259 this.methodCalled('setProtocolDefault', arguments); 276 this.methodCalled('setProtocolDefault', arguments);
260 }, 277 },
261 278
262 /** @override */ 279 /** @override */
263 removeProtocolHandler: function() { 280 removeProtocolHandler: function() {
264 this.methodCalled('removeProtocolHandler', arguments); 281 this.methodCalled('removeProtocolHandler', arguments);
265 } 282 }
266 }; 283 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698