2 # Copyright 2013 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 EXTENSIONS
10 from server_instance
import ServerInstance
11 from test_file_system
import TestFileSystem
16 '_api_features.json': json
.dumps({
19 'extension_types': ['platform_app']
24 'extension_types': ['extension']
28 'extension_types': ['platform_app'],
29 'whitelist': ['im not here']
33 'dependencies': ['manifest:omnibox'],
34 'contexts': ['blessed_extension']
37 'dependencies': ['permission:syncFileSystem'],
38 'contexts': ['blessed_extension']
42 'extension_types': ['extension', 'legacy_packaged_app'],
43 'contexts': ['blessed_extension']
47 'extension_types': 'all',
49 'blessed_extension', 'unblessed_extension', 'content_script']
52 'dependencies': ['api:tabs'],
53 'contexts': ['blessed_extension']
56 '_manifest_features.json': json
.dumps({
57 'app.content_security_policy': {
59 'extension_types': ['platform_app'],
60 'min_manifest_version': 2,
61 'whitelist': ['this isnt happening']
65 'extension_types': ['extension', 'legacy_packaged_app', 'hosted_app']
69 'extension_types': 'all'
73 'extension_types': ['extension']
77 'extension_types': ['extension']
81 'extension_types': ['platform_app']
84 '_permission_features.json': json
.dumps({
87 'extension_types': ['platform_app']
92 'extension', 'legacy_packaged_app', 'platform_app'
97 'extension_types': ['platform_app']
101 'extension_types': ['extension']
108 'manifest.json': json
.dumps({
110 'documentation': 'background_pages.html'
112 'manifest_version': {
113 'documentation': 'manifest/manifest_version.html',
118 'documentation': 'pageAction.html',
123 'permissions.json': json
.dumps({
124 'fakeUnsupportedFeature': {},
126 'partial': 'permissions/sync_file_system.html'
129 'partial': 'permissions/tabs.html'
138 class FeaturesBundleTest(unittest
.TestCase
):
140 self
._server
= ServerInstance
.ForTest(
141 TestFileSystem(_TEST_FILESYSTEM
, relative_to
=EXTENSIONS
))
143 def testManifestFeatures(self
):
144 expected_features
= {
146 'name': 'background',
148 'platforms': ['extensions'],
149 'documentation': 'background_pages.html'
151 'manifest_version': {
152 'name': 'manifest_version',
154 'platforms': ['apps', 'extensions'],
155 'documentation': 'manifest/manifest_version.html',
162 'platforms': ['extensions']
165 'name': 'page_action',
167 'platforms': ['extensions'],
168 'documentation': 'pageAction.html',
175 'platforms': ['apps']
180 self
._server
.features_bundle
.GetManifestFeatures().Get())
182 def testPermissionFeatures(self
):
183 expected_features
= {
187 'platforms': ['apps'],
189 'fakeUnsupportedFeature': {
190 'name': 'fakeUnsupportedFeature',
196 'platforms': ['apps', 'extensions'],
199 'name': 'syncFileSystem',
201 'platforms': ['apps'],
202 'partial': 'permissions/sync_file_system.html'
207 'platforms': ['extensions'],
208 'partial': 'permissions/tabs.html'
213 self
._server
.features_bundle
.GetPermissionFeatures().Get())
215 def testAPIFeatures(self
):
216 expected_features
= {
218 'name': 'audioCapture',
220 'platforms': ['apps']
223 'name': 'background',
225 'platforms': ['extensions']
229 'platforms': ['extensions'],
230 'contexts': ['blessed_extension'],
231 'dependencies': ['manifest:omnibox']
234 'name': 'syncFileSystem',
235 'platforms': ['apps'],
236 'contexts': ['blessed_extension'],
237 'dependencies': ['permission:syncFileSystem']
242 'platforms': ['extensions'],
243 'contexts': ['blessed_extension'],
248 'platforms': ['apps', 'extensions'],
250 'blessed_extension', 'unblessed_extension', 'content_script'],
254 'platforms': ['extensions'],
255 'contexts': ['blessed_extension'],
256 'dependencies': ['api:tabs']
261 self
._server
.features_bundle
.GetAPIFeatures().Get())
264 if __name__
== '__main__':