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

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

Issue 1836583003: MD Settings: Use paper-dropdown-menu for search engines. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change paper-item to div Created 4 years, 8 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
« 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
(Empty)
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
3 // found in the LICENSE file.
4
5 cr.define('settings_search', function() {
6 /**
7 * A test version of SearchEnginesBrowserProxy. Provides helper methods
8 * for allowing tests to know when a method was called, as well as
9 * specifying mock responses.
10 *
11 * @constructor
12 * @implements {settings.SearchEnginesBrowserProxy}
13 * @extends {settings.TestBrowserProxy}
14 */
15 var TestSearchEnginesBrowserProxy = function() {
16 settings.TestBrowserProxy.call(this, [
17 'getSearchEnginesList',
18 'removeSearchEngine',
19 'searchEngineEditCancelled',
20 'searchEngineEditCompleted',
21 'searchEngineEditStarted',
22 'setDefaultSearchEngine',
23 'validateSearchEngineInput',
24 'manageExtension',
25 'disableExtension',
26 ]);
27
28 /** @private {!SearchEnginesInfo} */
29 this.searchEnginesInfo_ = {defaults: [], others: [], extensions: []};
30 };
31
32 TestSearchEnginesBrowserProxy.prototype = {
33 __proto__: settings.TestBrowserProxy.prototype,
34
35 /** @override */
36 setDefaultSearchEngine: function(modelIndex) {
37 this.methodCalled('setDefaultSearchEngine', modelIndex);
38 },
39
40 /** @override */
41 removeSearchEngine: function(modelIndex) {
42 this.methodCalled('removeSearchEngine', modelIndex);
43 },
44
45 /** @override */
46 searchEngineEditStarted: function(modelIndex) {
47 this.methodCalled('searchEngineEditStarted', modelIndex);
48 },
49
50 /** @override */
51 searchEngineEditCancelled: function() {
52 this.methodCalled('searchEngineEditCancelled');
53 },
54
55 /** @override */
56 searchEngineEditCompleted: function(searchEngine, keyword, queryUrl) {
57 this.methodCalled('searchEngineEditCompleted');
58 },
59
60 /**
61 * Sets the response to be returned by |getSearchEnginesList|.
62 * @param {!SearchEnginesInfo}
63 */
64 setSearchEnginesInfo: function(searchEnginesInfo) {
65 this.searchEnginesInfo_ = searchEnginesInfo;
66 },
67
68 /** @override */
69 getSearchEnginesList: function() {
70 this.methodCalled('getSearchEnginesList');
71 return Promise.resolve(this.searchEnginesInfo_);
72 },
73
74 /** @override */
75 validateSearchEngineInput: function(fieldName, fieldValue) {
76 this.methodCalled('validateSearchEngineInput');
77 return Promise.resolve(true);
78 },
79
80 /** @override */
81 manageExtension: function(extensionId) {
82 this.methodCalled('manageExtension', extensionId);
83 },
84
85 /** @override */
86 disableExtension: function(extensionId) {
87 this.methodCalled('disableExtension', extensionId);
88 },
89 };
90
91 /**
92 * @param {boolean} canBeDefault
93 * @param {boolean} canBeEdited
94 * @param {boolean} canBeRemoved
95 * @return {!SearchEngine}
96 */
97 function createSampleSearchEngine(canBeDefault, canBeEdited, canBeRemoved) {
98 return {
99 canBeDefault: canBeDefault,
100 canBeEdited: canBeEdited,
101 canBeRemoved: canBeRemoved,
102 default: false,
103 displayName: "Google",
104 iconURL: "http://www.google.com/favicon.ico",
105 isOmniboxExtension: false,
106 keyword: "google.com",
107 modelIndex: 0,
108 name: "Google",
109 url: "https://search.foo.com/search?p=%s",
110 urlLocked: false,
111 };
112 }
113
114 return {
115 createSampleSearchEngine: createSampleSearchEngine,
116 TestSearchEnginesBrowserProxy: TestSearchEnginesBrowserProxy,
117 };
118 });
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