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

Unified 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, 9 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/test_search_engines_browser_proxy.js
diff --git a/chrome/test/data/webui/settings/test_search_engines_browser_proxy.js b/chrome/test/data/webui/settings/test_search_engines_browser_proxy.js
new file mode 100644
index 0000000000000000000000000000000000000000..ccf09e49f75fc261c64bcfdfa89349a2e24db14d
--- /dev/null
+++ b/chrome/test/data/webui/settings/test_search_engines_browser_proxy.js
@@ -0,0 +1,118 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('settings_search', function() {
+ /**
+ * A test version of SearchEnginesBrowserProxy. Provides helper methods
+ * for allowing tests to know when a method was called, as well as
+ * specifying mock responses.
+ *
+ * @constructor
+ * @implements {settings.SearchEnginesBrowserProxy}
+ * @extends {settings.TestBrowserProxy}
+ */
+ var TestSearchEnginesBrowserProxy = function() {
+ settings.TestBrowserProxy.call(this, [
+ 'getSearchEnginesList',
+ 'removeSearchEngine',
+ 'searchEngineEditCancelled',
+ 'searchEngineEditCompleted',
+ 'searchEngineEditStarted',
+ 'setDefaultSearchEngine',
+ 'validateSearchEngineInput',
+ 'manageExtension',
+ 'disableExtension',
+ ]);
+
+ /** @private {!SearchEnginesInfo} */
+ this.searchEnginesInfo_ = {defaults: [], others: [], extensions: []};
+ };
+
+ TestSearchEnginesBrowserProxy.prototype = {
+ __proto__: settings.TestBrowserProxy.prototype,
+
+ /** @override */
+ setDefaultSearchEngine: function(modelIndex) {
+ this.methodCalled('setDefaultSearchEngine', modelIndex);
+ },
+
+ /** @override */
+ removeSearchEngine: function(modelIndex) {
+ this.methodCalled('removeSearchEngine', modelIndex);
+ },
+
+ /** @override */
+ searchEngineEditStarted: function(modelIndex) {
+ this.methodCalled('searchEngineEditStarted', modelIndex);
+ },
+
+ /** @override */
+ searchEngineEditCancelled: function() {
+ this.methodCalled('searchEngineEditCancelled');
+ },
+
+ /** @override */
+ searchEngineEditCompleted: function(searchEngine, keyword, queryUrl) {
+ this.methodCalled('searchEngineEditCompleted');
+ },
+
+ /**
+ * Sets the response to be returned by |getSearchEnginesList|.
+ * @param {!SearchEnginesInfo}
+ */
+ setSearchEnginesInfo: function(searchEnginesInfo) {
+ this.searchEnginesInfo_ = searchEnginesInfo;
+ },
+
+ /** @override */
+ getSearchEnginesList: function() {
+ this.methodCalled('getSearchEnginesList');
+ return Promise.resolve(this.searchEnginesInfo_);
+ },
+
+ /** @override */
+ validateSearchEngineInput: function(fieldName, fieldValue) {
+ this.methodCalled('validateSearchEngineInput');
+ return Promise.resolve(true);
+ },
+
+ /** @override */
+ manageExtension: function(extensionId) {
+ this.methodCalled('manageExtension', extensionId);
+ },
+
+ /** @override */
+ disableExtension: function(extensionId) {
+ this.methodCalled('disableExtension', extensionId);
+ },
+ };
+
+ /**
+ * @param {boolean} canBeDefault
+ * @param {boolean} canBeEdited
+ * @param {boolean} canBeRemoved
+ * @return {!SearchEngine}
+ */
+ function createSampleSearchEngine(canBeDefault, canBeEdited, canBeRemoved) {
+ return {
+ canBeDefault: canBeDefault,
+ canBeEdited: canBeEdited,
+ canBeRemoved: canBeRemoved,
+ default: false,
+ displayName: "Google",
+ iconURL: "http://www.google.com/favicon.ico",
+ isOmniboxExtension: false,
+ keyword: "google.com",
+ modelIndex: 0,
+ name: "Google",
+ url: "https://search.foo.com/search?p=%s",
+ urlLocked: false,
+ };
+ }
+
+ return {
+ createSampleSearchEngine: createSampleSearchEngine,
+ TestSearchEnginesBrowserProxy: TestSearchEnginesBrowserProxy,
+ };
+});
« 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