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

Unified Diff: chrome/test/data/extensions/api_test/search_engines_private/test.js

Issue 1096143003: Add chrome.searchEnginesPrivate API and Search Settings page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update OWNERS Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/search_engines_private/test.js
diff --git a/chrome/test/data/extensions/api_test/search_engines_private/test.js b/chrome/test/data/extensions/api_test/search_engines_private/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..4e52b7e5462f15c469aa93b8f577240c3d334853
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/search_engines_private/test.js
@@ -0,0 +1,45 @@
+// Copyright 2015 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.
+
+// This just tests the interface. It does not test for specific results, only
+// that callbacks are correctly invoked, expected parameters are correct,
+// and failures are detected.
+
+function callbackResult(result) {
+ if (chrome.runtime.lastError)
+ chrome.test.fail(chrome.runtime.lastError.message);
+ else if (result == false)
+ chrome.test.fail('Failed: ' + result);
+}
+
+var availableTests = [
+ function setSelectedSearchEngine() {
+ chrome.searchEnginesPrivate.getDefaultSearchEngines(function(engines) {
+ chrome.searchEnginesPrivate.setSelectedSearchEngine(
+ engines[engines.length - 1].guid);
+ chrome.searchEnginesPrivate.getDefaultSearchEngines(function(newEngines) {
+ chrome.test.assertTrue(newEngines[newEngines.length - 1].isSelected);
+ chrome.test.succeed();
+ });
+ });
+ },
+
+ function onDefaultSearchEnginesChanged() {
+ chrome.searchEnginesPrivate.onDefaultSearchEnginesChanged.addListener(
+ function(engines) {
+ chrome.test.assertTrue(engines[1].isSelected,
+ 'Engine 1 should be selected');
+ chrome.test.succeed();
+ });
+ chrome.searchEnginesPrivate.getDefaultSearchEngines(function(engines) {
+ chrome.searchEnginesPrivate.setSelectedSearchEngine(engines[1].guid);
+ });
+ }
+];
+
+var testToRun = window.location.search.substring(1);
+chrome.test.runTests(availableTests.filter(function(op) {
+ return op.name == testToRun;
+}));
+

Powered by Google App Engine
This is Rietveld 408576698