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

Side by Side Diff: chrome/test/data/extensions/api_test/native_bindings/background.js

Issue 2575173002: [Extensions Bindings] Add a bridge to use current custom bindings (Closed)
Patch Set: . Created 4 years 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 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 if (!chrome || !chrome.test)
6 throw new Error('chrome.test is undefined');
7
8 // This is a good end-to-end test for two reasons. The first is obvious - it
9 // tests a simple API and makes sure it behaves as expected, as well as testing
10 // that other APIs are unavailable.
11 // The second is that chrome.test is itself an extension API, and a rather
12 // complex one. It requires both traditional bindings (renderer parses args,
13 // passes info to browser process, browser process does work and responds, re-
14 // enters JS) and custom JS bindings (in order to have our runTests, assert*
15 // methods, etc). If any of these stages failed, the test itself would also
16 // fail.
17 chrome.test.runTests([
18 function idleApi() {
19 chrome.test.assertTrue(!!chrome.idle);
20 chrome.test.assertTrue(!!chrome.idle.queryState);
21 chrome.idle.queryState(1000, function(state) {
22 // TODO(devlin): Update this to use chrome.idle.IdleState.ACTIVE when we
23 // have enums in native bindings.
24 chrome.test.assertEq('active', state);
25 chrome.test.succeed();
26 });
27 },
28 function nonexistentApi() {
29 chrome.test.assertFalse(!!chrome.nonexistent);
30 chrome.test.succeed();
31 },
32 function disallowedApi() {
33 chrome.test.assertFalse(!!chrome.power);
34 chrome.test.succeed();
35 },
36 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698