Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / runtime / content_script / content_script.js
blob6e877d6b212ea6314972107c5c42ff215b0d5baf
1 // Copyright (c) 2012 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.
5 var assertFalse = chrome.test.assertFalse;
6 var assertTrue = chrome.test.assertTrue;
7 var succeed = chrome.test.succeed;
9 function isAvailable(api) {
10 if (!(api in chrome.runtime))
11 return false;
13 try {
14 var mightThrowException = chrome.runtime[api];
15 } catch (e) {
16 return false;
19 // Defined and doesn't throw an exception on access. It's available.
20 return true;
23 assertTrue(chrome.hasOwnProperty('runtime'), 'chrome.runtime not defined.');
25 // Would test lastError but it's only defined when there's been an error.
26 assertTrue(isAvailable('id'), 'id not available.');
27 assertTrue(isAvailable('getManifest'), 'getManifest not available');
28 assertTrue(isAvailable('getURL'), 'getManifest not available');
29 assertFalse(isAvailable('getBackgroundPage'), 'getBackgroundPage available');
30 assertFalse(isAvailable('onInstalled'), 'onInstalled available');
31 assertFalse(isAvailable('onSuspend'), 'onSuspend available');
33 succeed();