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

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

Issue 14273041: Doc server manifest page generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Codereview fixes Created 7 years, 7 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
(Empty)
1 #!/usr/bin/env python
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.
5
6 import json
7 import unittest
8
9 from compiled_file_system import CompiledFileSystem
10 from manifest_data_source import ManifestDataSource
11 from object_store_creator import ObjectStoreCreator
12 from test_file_system import TestFileSystem
13
14 file_system = TestFileSystem({
15 "_manifest_features.json": json.dumps({
16 'req0': {
17 'channl': 'stable',
18 'extension_types': ['platform_app', 'extension']
19 },
20 'req1': {
21 'channel': 'dev',
22 'extension_types': 'all'
23 },
24 'opt0': {
25 'channel': 'trunk',
26 'extension_types': ['extension']
27 },
28 'opt1': {
29 'channel': 'stable',
30 'extension_types': ['hosted_app']
31 },
32 'free0': {
33 'channel': 'stable',
34 'extension_types': ['platform_app']
35 },
36 'free1': {
37 'channel': 'dev',
38 'extension_types': ['platform_app', 'hosted_app', 'extension']
39 }
40 }),
41 "manifest.json": json.dumps({
42 'required': [
43 {
44 'name': 'req0',
45 'example': 'Extension'
46 },
47 {'name': 'req1'}
48 ],
49 'optional': [
50 {'name': 'opt0'},
51 {'name': 'opt1'}
52 ]
53 })
54 })
55
56 class ManifestDataSourceTest(unittest.TestCase):
57 def testCreateManifestData(self):
58 expected_extensions = {
59 'required': [
60 {
61 'name': 'req0',
62 'example': 'Extension'
63 },
64 {'name': 'req1'}
65 ],
66 'recommended': [],
67 'only_one': [],
68 'optional': [
69 {'name': 'free1'},
70 {
71 'name': 'opt0',
72 'is_last': True
73 }
74 ]
75 }
76
77 expected_apps = {
78 'required': [
79 {
80 'name': 'req0',
81 'example': 'Application'
82 },
83 {'name': 'req1'}
84 ],
85 'recommended': [],
86 'only_one': [],
87 'optional': [
88 {'name': 'free0'},
89 {
90 'name': 'free1',
91 'is_last': True
92 }
93 ]
94 }
not at google - send to devlin 2013/05/11 22:19:04 pls augment the test so that all of the cases are
jshumway 2013/05/11 22:50:42 Done, I removed the channel attributes in the fake
95
96 mds = ManifestDataSource(
97 CompiledFileSystem.Factory(file_system, ObjectStoreCreator.ForTest()),
98 file_system, 'manifest.json', '_manifest_features.json', 'dev')
99
100 self.assertEqual(expected_extensions, mds.get('extensions'))
101 self.assertEqual(expected_apps, mds.get('apps'))
102
103 if __name__ == '__main__':
104 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698