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

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

Issue 2500513003: Make setting's protocol handler use cr-action-menu instead of paper-item. (Closed)
Patch Set: add tests to protocol handlers Created 4 years, 1 month 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 * @constructor 47 * @constructor
48 * @implements {settings.SiteSettingsPrefsBrowserProxy} 48 * @implements {settings.SiteSettingsPrefsBrowserProxy}
49 * @extends {settings.TestBrowserProxy} 49 * @extends {settings.TestBrowserProxy}
50 */ 50 */
51 var TestSiteSettingsPrefsBrowserProxy = function() { 51 var TestSiteSettingsPrefsBrowserProxy = function() {
52 settings.TestBrowserProxy.call(this, [ 52 settings.TestBrowserProxy.call(this, [
53 'fetchUsbDevices', 53 'fetchUsbDevices',
54 'fetchZoomLevels', 54 'fetchZoomLevels',
55 'getDefaultValueForContentType', 55 'getDefaultValueForContentType',
56 'getExceptionList', 56 'getExceptionList',
57 'initializeProtocolHandlerList',
58 'removeProtocolHandler',
57 'removeUsbDevice', 59 'removeUsbDevice',
58 'removeZoomLevel', 60 'removeZoomLevel',
59 'resetCategoryPermissionForOrigin', 61 'resetCategoryPermissionForOrigin',
60 'setCategoryPermissionForOrigin', 62 'setCategoryPermissionForOrigin',
61 'setDefaultValueForContentType', 63 'setDefaultValueForContentType',
64 'setProtocolDefault'
62 ]); 65 ]);
63 66
64 /** @private {!SiteSettingsPref} */ 67 /** @private {!SiteSettingsPref} */
65 this.prefs_ = prefsEmpty; 68 this.prefs_ = prefsEmpty;
66 69
67 /** @private {!Array<ZoomLevelEntry>} */ 70 /** @private {!Array<ZoomLevelEntry>} */
68 this.zoomList_ = []; 71 this.zoomList_ = [];
69 72
70 /** @private {!Array<UsbDeviceEntry>} */ 73 /** @private {!Array<UsbDeviceEntry>} */
71 this.usbDevices_ = []; 74 this.usbDevices_ = [];
75
76 /** @private {!Array<ProtocolEntry>} */
dpapad 2016/11/14 18:26:21 If those arrays do not hold null values, annotatio
scottchen 2016/11/14 21:38:37 Done.
77 this.protocolHandlers_ = [];
72 }; 78 };
73 79
74 TestSiteSettingsPrefsBrowserProxy.prototype = { 80 TestSiteSettingsPrefsBrowserProxy.prototype = {
75 __proto__: settings.TestBrowserProxy.prototype, 81 __proto__: settings.TestBrowserProxy.prototype,
76 82
77 /** 83 /**
78 * Sets the prefs to use when testing. 84 * Sets the prefs to use when testing.
79 * @param {!SiteSettingsPref} prefs The prefs to set. 85 * @param {!SiteSettingsPref} prefs The prefs to set.
80 */ 86 */
81 setPrefs: function(prefs) { 87 setPrefs: function(prefs) {
(...skipping 18 matching lines...) Expand all
100 106
101 /** 107 /**
102 * Sets the prefs to use when testing. 108 * Sets the prefs to use when testing.
103 * @param {!Array<UsbDeviceEntry>} list The usb device entry list to set. 109 * @param {!Array<UsbDeviceEntry>} list The usb device entry list to set.
104 */ 110 */
105 setUsbDevices: function(list) { 111 setUsbDevices: function(list) {
106 // Shallow copy of the passed-in array so mutation won't impact the source 112 // Shallow copy of the passed-in array so mutation won't impact the source
107 this.usbDevices_ = list.slice(); 113 this.usbDevices_ = list.slice();
108 }, 114 },
109 115
116 /**
117 * Sets the prefs to use when testing.
118 * @param {!Array<ProtocolEntry>} list The protocol handlers list to set.
119 */
120 setProtocolHandlers: function(list) {
121 // Shallow copy of the passed-in array so mutation won't impact the source
122 this.protocolHandlers_ = list.slice();
123 },
124
110 /** @override */ 125 /** @override */
111 setDefaultValueForContentType: function(contentType, defaultValue) { 126 setDefaultValueForContentType: function(contentType, defaultValue) {
112 this.methodCalled( 127 this.methodCalled(
113 'setDefaultValueForContentType', [contentType, defaultValue]); 128 'setDefaultValueForContentType', [contentType, defaultValue]);
114 }, 129 },
115 130
116 /** @override */ 131 /** @override */
117 getDefaultValueForContentType: function(contentType) { 132 getDefaultValueForContentType: function(contentType) {
118 this.methodCalled('getDefaultValueForContentType', contentType); 133 this.methodCalled('getDefaultValueForContentType', contentType);
119 134
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 243
229 /** @override */ 244 /** @override */
230 fetchUsbDevices: function() { 245 fetchUsbDevices: function() {
231 this.methodCalled('fetchUsbDevices'); 246 this.methodCalled('fetchUsbDevices');
232 return Promise.resolve(this.usbDevices_); 247 return Promise.resolve(this.usbDevices_);
233 }, 248 },
234 249
235 /** @override */ 250 /** @override */
236 removeUsbDevice: function() { 251 removeUsbDevice: function() {
237 this.methodCalled('removeUsbDevice', arguments); 252 this.methodCalled('removeUsbDevice', arguments);
253 },
254
255 /** @override */
256 initializeProtocolHandlerList: function() {
257 cr.webUIListenerCallback('setHandlersEnabled', true);
258 cr.webUIListenerCallback('setProtocolHandlers', this.protocolHandlers_);
259 this.methodCalled('initializeProtocolHandlerList');
260 return Promise.resolve();
dpapad 2016/11/14 18:26:21 The prod version of initializeProtocolHandlerList
scottchen 2016/11/14 21:38:37 Done.
261 },
262
263 /** @override */
264 setProtocolDefault: function() {
265 this.methodCalled('setProtocolDefault', arguments);
266 },
267
268 /** @override */
269 removeProtocolHandler: function() {
270 this.methodCalled('removeProtocolHandler', arguments);
238 } 271 }
239 }; 272 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698