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

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

Issue 2572963004: MD Settings: Add "Show Google Now cards in the launcher" row in Search section. (Closed)
Patch Set: Rebase Created 4 years 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
« no previous file with comments | « chrome/test/data/webui/settings/search_page_test.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cr.define('settings_search', function() { 5 cr.define('settings_search', function() {
6 /** 6 /**
7 * A test version of SearchEnginesBrowserProxy. Provides helper methods 7 * A test version of SearchEnginesBrowserProxy. Provides helper methods
8 * for allowing tests to know when a method was called, as well as 8 * for allowing tests to know when a method was called, as well as
9 * specifying mock responses. 9 * specifying mock responses.
10 * 10 *
11 * @constructor 11 * @constructor
12 * @implements {settings.SearchEnginesBrowserProxy} 12 * @implements {settings.SearchEnginesBrowserProxy}
13 * @extends {settings.TestBrowserProxy} 13 * @extends {settings.TestBrowserProxy}
14 */ 14 */
15 var TestSearchEnginesBrowserProxy = function() { 15 var TestSearchEnginesBrowserProxy = function() {
16 settings.TestBrowserProxy.call(this, [ 16 settings.TestBrowserProxy.call(this, [
17 'getSearchEnginesList', 17 'getSearchEnginesList',
18 'removeSearchEngine', 18 'removeSearchEngine',
19 'searchEngineEditCancelled', 19 'searchEngineEditCancelled',
20 'searchEngineEditCompleted', 20 'searchEngineEditCompleted',
21 'searchEngineEditStarted', 21 'searchEngineEditStarted',
22 'setDefaultSearchEngine', 22 'setDefaultSearchEngine',
23 'validateSearchEngineInput', 23 'validateSearchEngineInput',
24 'getHotwordInfo', 24 'getHotwordInfo',
25 'setHotwordSearchEnabled', 25 'setHotwordSearchEnabled',
26 'getGoogleNowAvailability',
26 ]); 27 ]);
27 28
28 /** @type {boolean} */ 29 /** @type {boolean} */
29 this.hotwordSearchEnabled = false; 30 this.hotwordSearchEnabled = false;
30 31
31 /** @private {!SearchEnginesInfo} */ 32 /** @private {!SearchEnginesInfo} */
32 this.searchEnginesInfo_ = {defaults: [], others: [], extensions: []}; 33 this.searchEnginesInfo_ = {defaults: [], others: [], extensions: []};
33 34
34 /** @private {!SearchPageHotwordInfo} */ 35 /** @private {!SearchPageHotwordInfo} */
35 this.hotwordInfo_ = { 36 this.hotwordInfo_ = {
36 allowed: true, 37 allowed: true,
37 enabled: false, 38 enabled: false,
38 alwaysOn: true, 39 alwaysOn: true,
39 errorMessage: '', 40 errorMessage: '',
40 userName: 'user@test.org', 41 userName: 'user@test.org',
41 historyEnabled: false, 42 historyEnabled: false,
42 }; 43 };
44
45 /** @type {boolean} */
46 this.googleNowAvailable = true;
43 }; 47 };
44 48
45 TestSearchEnginesBrowserProxy.prototype = { 49 TestSearchEnginesBrowserProxy.prototype = {
46 __proto__: settings.TestBrowserProxy.prototype, 50 __proto__: settings.TestBrowserProxy.prototype,
47 51
48 /** @override */ 52 /** @override */
49 setDefaultSearchEngine: function(modelIndex) { 53 setDefaultSearchEngine: function(modelIndex) {
50 this.methodCalled('setDefaultSearchEngine', modelIndex); 54 this.methodCalled('setDefaultSearchEngine', modelIndex);
51 }, 55 },
52 56
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 }, 93 },
90 94
91 /** @override */ 95 /** @override */
92 setHotwordSearchEnabled: function(enabled) { 96 setHotwordSearchEnabled: function(enabled) {
93 this.hotwordSearchEnabled = enabled; 97 this.hotwordSearchEnabled = enabled;
94 this.hotwordInfo_.enabled = true; 98 this.hotwordInfo_.enabled = true;
95 this.hotwordInfo_.historyEnabled = this.hotwordInfo_.alwaysOn; 99 this.hotwordInfo_.historyEnabled = this.hotwordInfo_.alwaysOn;
96 this.methodCalled('setHotwordSearchEnabled'); 100 this.methodCalled('setHotwordSearchEnabled');
97 }, 101 },
98 102
103 /** @override */
104 getGoogleNowAvailability: function() {
105 this.methodCalled('getGoogleNowAvailability');
106 return Promise.resolve(this.googleNowAvailable);
107 },
108
99 /** 109 /**
100 * Sets the response to be returned by |getSearchEnginesList|. 110 * Sets the response to be returned by |getSearchEnginesList|.
101 * @param {!SearchEnginesInfo} searchEnginesInfo 111 * @param {!SearchEnginesInfo} searchEnginesInfo
102 */ 112 */
103 setSearchEnginesInfo: function(searchEnginesInfo) { 113 setSearchEnginesInfo: function(searchEnginesInfo) {
104 this.searchEnginesInfo_ = searchEnginesInfo; 114 this.searchEnginesInfo_ = searchEnginesInfo;
105 }, 115 },
106 116
107 /** 117 /**
108 * Sets the response to be returned by |getSearchEnginesList|. 118 * Sets the response to be returned by |getSearchEnginesList|.
(...skipping 26 matching lines...) Expand all
135 url: "https://search.foo.com/search?p=%s", 145 url: "https://search.foo.com/search?p=%s",
136 urlLocked: false, 146 urlLocked: false,
137 }; 147 };
138 } 148 }
139 149
140 return { 150 return {
141 createSampleSearchEngine: createSampleSearchEngine, 151 createSampleSearchEngine: createSampleSearchEngine,
142 TestSearchEnginesBrowserProxy: TestSearchEnginesBrowserProxy, 152 TestSearchEnginesBrowserProxy: TestSearchEnginesBrowserProxy,
143 }; 153 };
144 }); 154 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/search_page_test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698