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

Side by Side 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, 7 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
OLDNEW
(Empty)
1 // Copyright 2015 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 // This just tests the interface. It does not test for specific results, only
6 // that callbacks are correctly invoked, expected parameters are correct,
7 // and failures are detected.
8
9 function callbackResult(result) {
10 if (chrome.runtime.lastError)
11 chrome.test.fail(chrome.runtime.lastError.message);
12 else if (result == false)
13 chrome.test.fail('Failed: ' + result);
14 }
15
16 var availableTests = [
17 function setSelectedSearchEngine() {
18 chrome.searchEnginesPrivate.getDefaultSearchEngines(function(engines) {
19 chrome.searchEnginesPrivate.setSelectedSearchEngine(
20 engines[engines.length - 1].guid);
21 chrome.searchEnginesPrivate.getDefaultSearchEngines(function(newEngines) {
22 chrome.test.assertTrue(newEngines[newEngines.length - 1].isSelected);
23 chrome.test.succeed();
24 });
25 });
26 },
27
28 function onDefaultSearchEnginesChanged() {
29 chrome.searchEnginesPrivate.onDefaultSearchEnginesChanged.addListener(
30 function(engines) {
31 chrome.test.assertTrue(engines[1].isSelected,
32 'Engine 1 should be selected');
33 chrome.test.succeed();
34 });
35 chrome.searchEnginesPrivate.getDefaultSearchEngines(function(engines) {
36 chrome.searchEnginesPrivate.setSelectedSearchEngine(engines[1].guid);
37 });
38 }
39 ];
40
41 var testToRun = window.location.search.substring(1);
42 chrome.test.runTests(availableTests.filter(function(op) {
43 return op.name == testToRun;
44 }));
45
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698