OLD | NEW |
(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 chrome.test.runTests([ |
| 6 function() { |
| 7 // Test management (backed by a json file) api enums. |
| 8 |
| 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); |
| 25 |
| 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, |
| 34 'granted'); |
| 35 chrome.test.assertTrue( |
| 36 Object.keys(chrome.notifications.PermissionLevel).length > 1); |
| 37 |
| 38 chrome.test.succeed(); |
| 39 } |
| 40 ]); |
OLD | NEW |