Chromium Code Reviews| 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..87d0fcb40c90ba466d1381e8707e943cac59ff16 |
| --- /dev/null |
| +++ b/chrome/test/data/extensions/api_test/search_engines_private/test.js |
| @@ -0,0 +1,33 @@ |
| +// 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(); |
| + }); |
| + }); |
|
stevenjb
2015/04/23 17:26:01
We should test the changed event also.
Oren Blasberg
2015/04/23 21:31:51
Done.
|
| + }, |
| +]; |
| + |
| +var testToRun = window.location.search.substring(1); |
| +chrome.test.runTests(availableTests.filter(function(op) { |
| + return op.name == testToRun; |
| +})); |
| + |