2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
9 from extensions_paths
import CHROME_API
, CHROME_EXTENSIONS
, EXTENSIONS_API
10 from mock_file_system
import MockFileSystem
11 from server_instance
import ServerInstance
12 from test_file_system
import TestFileSystem
13 from test_util
import ReadFile
19 'inspected_window.json': ReadFile(
20 CHROME_API
, 'devtools', 'inspected_window.json'),
22 '_api_features.json': json
.dumps({
24 'app': {'extension_types': ['platform_app']},
25 'app.runtime': {'noparent': True},
26 'app.runtime.foo': {'extension_types': ['extension']},
27 'declarativeWebRequest': {'extension_types': ['extension']},
28 'devtools.inspectedWindow': {'extension_types': ['extension']},
29 'input': {'extension_types': 'all'},
30 'input.ime': {'extension_types': ['extension', 'platform_app']},
31 'storage': {'extension_types': ['extension']},
33 '_manifest_features.json': '{}',
34 '_permission_features.json': '{}',
35 'alarms.idl': ReadFile(EXTENSIONS_API
, 'alarms.idl'),
36 'input_ime.json': ReadFile(CHROME_API
, 'input_ime.json'),
37 'page_action.json': ReadFile(CHROME_API
, 'page_action.json'),
42 'manifest.json': '{}',
43 'permissions.json': '{}',
50 class PlatformBundleTest(unittest
.TestCase
):
52 mock_file_system
= MockFileSystem(
53 TestFileSystem(_TEST_DATA
, relative_to
=CHROME_EXTENSIONS
))
54 server_instance
= ServerInstance
.ForTest(file_system
=mock_file_system
)
55 self
._platform
_bundle
= server_instance
.platform_bundle
57 def testGetters(self
):
61 'declarativeWebRequest',
62 'devtools.inspectedWindow',
65 ], sorted(self
._platform
_bundle
.GetAPIModels('extensions').GetNames()))
72 ], sorted(self
._platform
_bundle
.GetAPIModels('apps').GetNames()))
76 'name': 'app.runtime',
80 'declarativeWebRequest': {
81 'name': 'declarativeWebRequest',
83 'extension_types': ['extension'],
86 'name': 'app.runtime.foo',
88 'extension_types': ['extension'],
93 'extension_types': ['extension'],
98 'extension_types': ['extension', 'platform_app'],
107 'extension_types': 'all'
109 'devtools.inspectedWindow': {
110 'name': 'devtools.inspectedWindow',
112 'extension_types': ['extension'],
114 }, self
._platform
_bundle
.GetFeaturesBundle(
115 'extensions').GetAPIFeatures().Get())
119 'name': 'app.runtime',
126 'extension_types': 'all'
131 'extension_types': ['extension', 'platform_app'],
136 'extension_types': ['platform_app'],
142 }, self
._platform
_bundle
.GetFeaturesBundle('apps').GetAPIFeatures().Get())
144 # Check that 'app' is resolved successfully in apps, but is None otherwise.
147 self
._platform
_bundle
.GetReferenceResolver('apps').GetLink('app'))
150 self
._platform
_bundle
.GetReferenceResolver('extensions').GetLink('app'))
152 if __name__
== '__main__':