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.
7 // Test management (backed by a json file) api enums.
9 // The enum should be declared on the API object.
10 chrome.test.assertTrue(
11 'LaunchType' in chrome.management,
12 '"LaunchType" is not present on chrome.management.');
13 // The object should have entries for each enum entry. Note that we don't
14 // test all entries here because we don't want to update this test if the
15 // management api changes.
16 chrome.test.assertTrue(
17 'OPEN_AS_REGULAR_TAB' in chrome.management.LaunchType,
18 '"OPEN_AS_REGULAR_TAB" is not present on management.LaunchType');
19 // The value of the enum should be its string value.
20 chrome.test.assertEq(chrome.management.LaunchType.OPEN_AS_REGULAR_TAB,
21 'OPEN_AS_REGULAR_TAB');
22 // There should be more than one value for the enum.
23 chrome.test.assertTrue(
24 Object.keys(chrome.management.LaunchType).length > 1);
26 // Perform an analogous test for the notifications api (backed by an idl).
27 chrome.test.assertTrue(
28 'PermissionLevel' in chrome.notifications,
29 '"PermissionLevel" is not present on chrome.notifications.');
30 chrome.test.assertTrue(
31 'GRANTED' in chrome.notifications.PermissionLevel,
32 '"GRANTED" is not present on notifications.PermissionLevel');
33 chrome.test.assertEq(chrome.notifications.PermissionLevel.GRANTED,
35 chrome.test.assertTrue(
36 Object.keys(chrome.notifications.PermissionLevel).length > 1);
38 chrome.test.assertTrue('PlatformArch' in chrome.runtime,
39 '"PlatformArch" is not present on chrome.runtime.');
40 chrome.test.assertTrue('X86_64' in chrome.runtime.PlatformArch,
41 '"X86_64" is not present on runtime.PlatformArch.');
42 chrome.test.assertEq('x86-64', chrome.runtime.PlatformArch.X86_64);
44 chrome.test.assertTrue(
45 'OnInputEnteredDisposition' in chrome.omnibox,
46 '"OnInputEnteredDisposition" is not present on chrome.runtime.');
47 chrome.test.assertTrue(
48 'NEW_FOREGROUND_TAB' in chrome.omnibox.OnInputEnteredDisposition,
49 '"NEW_FOREGROUND_TAB" is not present on OnInputEnteredDisposition.');
52 chrome.omnibox.OnInputEnteredDisposition.NEW_FOREGROUND_TAB);
54 chrome.test.succeed();