Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: chrome/common/extensions/docs/server2/manifest_data_source_test.py

Issue 16410002: Docserver manifest follow up (rewrite) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gen-manifest-try-2
Patch Set: Small URL change Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import json 6 import json
7 import unittest 7 import unittest
8 8
9 from compiled_file_system import CompiledFileSystem 9 from compiled_file_system import CompiledFileSystem
10 from manifest_data_source import ManifestDataSource 10 from manifest_data_source import ManifestDataSource
(...skipping 24 matching lines...) Expand all
35 'extension_types': 'all' 35 'extension_types': 'all'
36 }, 36 },
37 'only1': { 37 'only1': {
38 'extension_types': ['platform_app'] 38 'extension_types': ['platform_app']
39 }, 39 },
40 'rec0': { 40 'rec0': {
41 'extension_types': ['extension'] 41 'extension_types': ['extension']
42 }, 42 },
43 'rec1': { 43 'rec1': {
44 'extension_types': ['platform_app', 'extension'] 44 'extension_types': ['platform_app', 'extension']
45 },
46 'req0.opt2': {
47 'extension_types': ['extension']
45 } 48 }
46 }), 49 }),
47 "manifest.json": json.dumps({ 50 "manifest.json": json.dumps({
48 'required': [ 51 'required': [
49 { 52 {
50 'name': 'req0', 53 'name': 'req0',
51 'example': 'Extension' 54 'example': {'value': 'Extension'}
52 }, 55 },
53 {'name': 'req1'} 56 {'name': 'req1'}
54 ], 57 ],
55 'only_one': [ 58 'only_one': [
56 {'name': 'only0'}, 59 {'name': 'only0'},
57 {'name': 'only1'} 60 {'name': 'only1'}
58 ], 61 ],
59 'recommended': [ 62 'recommended': [
60 {'name': 'rec0'}, 63 {'name': 'rec0'},
61 {'name': 'rec1'} 64 {'name': 'rec1'}
62 ], 65 ],
63 'optional': [ 66 'optional': [
64 {'name': 'opt0'}, 67 {'name': 'opt0'},
65 {'name': 'opt1'} 68 {'name': 'opt1'},
69 {'name': 'req0.opt2'}
66 ] 70 ]
67 }) 71 })
68 }) 72 })
69 73
70 class ManifestDataSourceTest(unittest.TestCase): 74 class ManifestDataSourceTest(unittest.TestCase):
71 def testCreateManifestData(self): 75 def testCreateManifestData(self):
72 expected_extensions = { 76 expected_extensions = {
73 'required': [ 77 'required': [
74 { 78 {
75 'name': 'req0', 79 'name': 'req0',
76 'example': 'Extension' 80 'example': {'value': 'Extension'},
81 'subdoc': [
82 {'name': 'opt2'}
83 ]
77 }, 84 },
78 {'name': 'req1'} 85 {'name': 'req1'}
79 ], 86 ],
80 'recommended': [ 87 'recommended': [
81 {'name': 'rec0'}, 88 {'name': 'rec0'},
82 {'name': 'rec1'} 89 {'name': 'rec1'}
83 ], 90 ],
84 'only_one': [ 91 'only_one': [
85 {'name': 'only0'} 92 {'name': 'only0'}
86 ], 93 ],
87 'optional': [ 94 'optional': [
88 {'name': 'free1'}, 95 {'name': 'free1'},
89 { 96 {
90 'name': 'opt0', 97 'name': 'opt0',
91 'is_last': True 98 'is_last': True
92 } 99 }
93 ] 100 ]
94 } 101 }
95 102
96 expected_apps = { 103 expected_apps = {
97 'required': [ 104 'required': [
98 { 105 {
99 'name': 'req0', 106 'name': 'req0',
100 'example': 'Application' 107 'example': {'value': 'Application'}
101 }, 108 },
102 {'name': 'req1'} 109 {'name': 'req1'}
103 ], 110 ],
104 'recommended': [ 111 'recommended': [
105 {'name': 'rec1'} 112 {'name': 'rec1'}
106 ], 113 ],
107 'only_one': [ 114 'only_one': [
108 {'name': 'only0'}, 115 {'name': 'only0'},
109 {'name': 'only1'} 116 {'name': 'only1'}
110 ], 117 ],
111 'optional': [ 118 'optional': [
112 {'name': 'free0'}, 119 {'name': 'free0'},
113 { 120 {
114 'name': 'free1', 121 'name': 'free1',
115 'is_last': True 122 'is_last': True
116 } 123 }
117 ] 124 ]
118 } 125 }
119 126
120 mds = ManifestDataSource( 127 mds = ManifestDataSource(
121 CompiledFileSystem.Factory(file_system, ObjectStoreCreator.ForTest()), 128 CompiledFileSystem.Factory(file_system, ObjectStoreCreator.ForTest()),
122 file_system, 'manifest.json', '_manifest_features.json') 129 file_system, 'manifest.json', '_manifest_features.json')
123 130
124 self.assertEqual(expected_extensions, mds.get('extensions')) 131 self.assertEqual(expected_extensions, mds.get('extensions'))
125 self.assertEqual(expected_apps, mds.get('apps')) 132 self.assertEqual(expected_apps, mds.get('apps'))
126 133
127 if __name__ == '__main__': 134 if __name__ == '__main__':
128 unittest.main() 135 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698