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 CHROME_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']
32 'inheritsFromDifferentDependencyName': {
33 'dependencies': ['manifest:inheritsPlatformAndChannelFromDependency']
35 'inheritsPlatformAndChannelFromDependency': {
36 'dependencies': ['manifest:inheritsPlatformAndChannelFromDependency']
39 'dependencies': ['manifest:omnibox'],
40 'contexts': ['blessed_extension']
43 'dependencies': ['permission:syncFileSystem'],
44 'contexts': ['blessed_extension']
48 'extension_types': ['extension', 'legacy_packaged_app'],
49 'contexts': ['blessed_extension']
53 'extension_types': 'all',
55 'blessed_extension', 'unblessed_extension', 'content_script']
57 'overridesPlatformAndChannelFromDependency': {
60 'permission:overridesPlatformAndChannelFromDependency'
62 'extension_types': ['platform_app']
65 'dependencies': ['api:tabs'],
66 'contexts': ['blessed_extension']
69 'dependencies': ['api:testDeep2']
72 'dependencies': ['api:testDeep3']
75 'dependencies': ['manifest:testDeep4']
77 'testDeep1.child': {},
78 'multipleAmbiguous': [{
80 'extension_types': ['platform_app']
83 'dependencies': ['manifest:multipleAmbiguous']
85 'mergingDependencies1': {
87 'permission:mergingDependencies1',
88 'permission:mergingDependencies2'
91 'mergingDependencies2': {
93 'permission:mergingDependencies1',
94 'permission:mergingDependencies3'
97 'mergingDependencies3': {
99 'permission:mergingDependencies2',
100 'permission:mergingDependencies3'
103 'implicitNoParent.child': {
104 'extension_types': ['extension'],
108 'extension_types': ['extension'],
111 'parent.explicitNoParent': {
112 'extension_types': ['extension'],
115 'parent.inheritAndOverride': {
118 'overridePlatform': {
119 'dependencies': ['permission:tabs'],
120 'extension_types': 'platform_app'
122 'mergeMostStableChannel': [{
124 'extension_types': ['extension'],
128 'extension_types': ['extension'],
132 'extension_types': ['extension'],
136 'extension_types': ['extension'],
139 'extension_types': ['extension'],
143 '_manifest_features.json': json
.dumps({
144 'app.content_security_policy': {
146 'extension_types': ['platform_app'],
147 'min_manifest_version': 2,
148 'whitelist': ['this isnt happening']
152 'extension_types': ['extension', 'legacy_packaged_app', 'hosted_app']
154 'inheritsPlatformAndChannelFromDependency': {
156 'extension_types': ['extension']
158 'manifest_version': {
160 'extension_types': 'all'
164 'extension_types': ['extension'],
169 'extension_types': ['extension']
173 'extension_types': ['platform_app']
176 'extension_types': ['extension']
178 'multipleAmbiguous': {
179 'extension_types': ['extension']
182 '_permission_features.json': json
.dumps({
185 'extension_types': ['platform_app']
187 'overridesPlatformAndChannelFromDependency': {
189 'extension_types': ['extension']
194 'extension', 'legacy_packaged_app', 'platform_app'
199 'extension_types': ['platform_app']
203 'extension_types': ['extension']
205 'mergingDependencies1': {
207 'extension_types': 'all'
209 'mergingDependencies2': {
211 'extension_types': ['platform_app']
213 'mergingDependencies3': {
214 'extension_types': ['extension']
222 'manifest.json': json
.dumps({
224 'documentation': 'background_pages.html'
226 'manifest_version': {
227 'documentation': 'manifest/manifest_version.html',
232 'documentation': 'pageAction.html',
237 'permissions.json': json
.dumps({
238 'fakeUnsupportedFeature': {},
240 'partial': 'permissions/sync_file_system.html'
243 'partial': 'permissions/tabs.html'
252 class FeaturesBundleTest(unittest
.TestCase
):
254 self
._server
= ServerInstance
.ForTest(
255 TestFileSystem(_TEST_FILESYSTEM
, relative_to
=CHROME_EXTENSIONS
))
257 def testManifestFeatures(self
):
258 expected_features
= {
260 'name': 'background',
262 'documentation': 'background_pages.html',
263 'extension_types': ['extension', 'legacy_packaged_app', 'hosted_app']
265 'inheritsPlatformAndChannelFromDependency': {
266 'name': 'inheritsPlatformAndChannelFromDependency',
268 'extension_types': ['extension']
270 'manifest_version': {
271 'name': 'manifest_version',
273 'documentation': 'manifest/manifest_version.html',
274 'extension_types': 'all',
281 'extension_types': ['extension'],
282 'platforms': ['win'],
285 'name': 'page_action',
287 'documentation': 'pageAction.html',
288 'extension_types': ['extension'],
295 'extension_types': ['extension']
297 'multipleAmbiguous': {
298 'name': 'multipleAmbiguous',
300 'extension_types': ['extension']
305 self
._server
.platform_bundle
.GetFeaturesBundle(
306 'extensions').GetManifestFeatures().Get())
307 expected_features
= {
308 'manifest_version': {
309 'name': 'manifest_version',
311 'documentation': 'manifest/manifest_version.html',
312 'extension_types': 'all',
319 'extension_types': ['platform_app']
324 self
._server
.platform_bundle
.GetFeaturesBundle(
325 'apps').GetManifestFeatures().Get())
327 def testPermissionFeatures(self
):
328 expected_features
= {
332 'extension_types': ['extension', 'legacy_packaged_app', 'platform_app']
334 'overridesPlatformAndChannelFromDependency': {
335 'name': 'overridesPlatformAndChannelFromDependency',
337 'extension_types': ['extension']
342 'extension_types': ['extension'],
343 'partial': 'permissions/tabs.html'
345 'mergingDependencies1': {
346 'name': 'mergingDependencies1',
348 'extension_types': 'all'
350 'mergingDependencies3': {
351 'name': 'mergingDependencies3',
353 'extension_types': ['extension']
362 self
._server
.platform_bundle
.GetFeaturesBundle(
363 'extensions').GetPermissionFeatures().Get())
364 expected_features
= {
368 'extension_types': ['platform_app']
373 'extension_types': ['extension', 'legacy_packaged_app', 'platform_app']
376 'name': 'syncFileSystem',
378 'extension_types': ['platform_app'],
379 'partial': 'permissions/sync_file_system.html'
381 'mergingDependencies1': {
382 'name': 'mergingDependencies1',
384 'extension_types': 'all'
386 'mergingDependencies2': {
387 'name': 'mergingDependencies2',
389 'extension_types': ['platform_app']
398 self
._server
.platform_bundle
.GetFeaturesBundle(
399 'apps').GetPermissionFeatures().Get())
401 def testAPIFeatures(self
):
402 expected_features
= {
404 'name': 'background',
406 'extension_types': ['extension']
410 'contexts': ['blessed_extension'],
411 'dependencies': ['manifest:omnibox'],
417 'contexts': ['blessed_extension'],
418 'extension_types': ['extension', 'legacy_packaged_app'],
424 'blessed_extension', 'unblessed_extension', 'content_script'],
425 'extension_types': 'all',
429 'contexts': ['blessed_extension'],
430 'dependencies': ['api:tabs'],
435 'dependencies': ['api:testDeep2'],
440 'dependencies': ['api:testDeep3'],
445 'dependencies': ['manifest:testDeep4'],
449 'name': 'testDeep1.child',
451 'dependencies': ['api:testDeep2']
453 'multipleAmbiguous': {
454 'name': 'multipleAmbiguous',
456 'dependencies': ['manifest:multipleAmbiguous'],
459 'mergingDependencies2': {
460 'name': 'mergingDependencies2',
462 'permission:mergingDependencies1',
463 'permission:mergingDependencies3'
467 'inheritsFromDifferentDependencyName': {
469 'name': 'inheritsFromDifferentDependencyName',
470 'dependencies': ['manifest:inheritsPlatformAndChannelFromDependency'],
472 'inheritsPlatformAndChannelFromDependency': {
474 'name': 'inheritsPlatformAndChannelFromDependency',
475 'dependencies': ['manifest:inheritsPlatformAndChannelFromDependency'],
477 'implicitNoParent.child': {
478 'name': 'implicitNoParent.child',
480 'extension_types': ['extension'],
485 'extension_types': ['extension'],
487 'parent.explicitNoParent': {
488 'name': 'parent.explicitNoParent',
490 'extension_types': ['extension'],
493 'parent.inheritAndOverride': {
494 'name': 'parent.inheritAndOverride',
496 'extension_types': ['extension']
498 'mergeMostStableChannel': {
499 'name': 'mergeMostStableChannel',
501 'extension_types': ['extension'],
509 self
._server
.platform_bundle
.GetFeaturesBundle(
510 'extensions').GetAPIFeatures().Get())
511 expected_features
= {
513 'name': 'audioCapture',
515 'extension_types': ['platform_app']
518 'name': 'syncFileSystem',
519 'contexts': ['blessed_extension'],
520 'dependencies': ['permission:syncFileSystem'],
527 'blessed_extension', 'unblessed_extension', 'content_script'],
528 'extension_types': 'all',
530 'multipleAmbiguous': {
531 'name': 'multipleAmbiguous',
533 'extension_types': ['platform_app'],
536 'mergingDependencies1': {
537 'name': 'mergingDependencies1',
540 'permission:mergingDependencies1',
541 'permission:mergingDependencies2'
544 'overridesPlatformAndChannelFromDependency': {
545 'name': 'overridesPlatformAndChannelFromDependency',
548 'permission:overridesPlatformAndChannelFromDependency'
550 'extension_types': ['platform_app']
552 'overridePlatform': {
553 'name': 'overridePlatform',
555 'dependencies': ['permission:tabs'],
556 'extension_types': 'platform_app'
561 self
._server
.platform_bundle
.GetFeaturesBundle(
562 'apps').GetAPIFeatures().Get())
565 if __name__
== '__main__':