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

Unified 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: epeterson's nits Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/manifest_data_source_test.py
diff --git a/chrome/common/extensions/docs/server2/manifest_data_source_test.py b/chrome/common/extensions/docs/server2/manifest_data_source_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..3f971b6b5d0cdab9613cd633443886f99dc5bbcd
--- /dev/null
+++ b/chrome/common/extensions/docs/server2/manifest_data_source_test.py
@@ -0,0 +1,128 @@
+#!/usr/bin/env python
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import json
+import unittest
+
+from compiled_file_system import CompiledFileSystem
+from manifest_data_source import ManifestDataSource
+from object_store_creator import ObjectStoreCreator
+from test_file_system import TestFileSystem
+
+file_system = TestFileSystem({
+ "_manifest_features.json": json.dumps({
+ 'req0': {
+ 'extension_types': ['platform_app', 'extension']
+ },
+ 'req1': {
+ 'extension_types': 'all'
+ },
+ 'opt0': {
+ 'extension_types': ['extension']
+ },
+ 'opt1': {
+ 'extension_types': ['hosted_app']
+ },
+ 'free0': {
+ 'extension_types': ['platform_app']
+ },
+ 'free1': {
+ 'extension_types': ['platform_app', 'hosted_app', 'extension']
+ },
+ 'only0': {
+ 'extension_types': 'all'
+ },
+ 'only1': {
+ 'extension_types': ['platform_app']
+ },
+ 'rec0': {
+ 'extension_types': ['extension']
+ },
+ 'rec1': {
+ 'extension_types': ['platform_app', 'extension']
+ }
+ }),
+ "manifest.json": json.dumps({
+ 'required': [
+ {
+ 'name': 'req0',
+ 'example': 'Extension'
+ },
+ {'name': 'req1'}
+ ],
+ 'only_one': [
+ {'name': 'only0'},
+ {'name': 'only1'}
+ ],
+ 'recommended': [
+ {'name': 'rec0'},
+ {'name': 'rec1'}
+ ],
+ 'optional': [
+ {'name': 'opt0'},
+ {'name': 'opt1'}
+ ]
+ })
+})
+
+class ManifestDataSourceTest(unittest.TestCase):
+ def testCreateManifestData(self):
+ expected_extensions = {
+ 'required': [
+ {
+ 'name': 'req0',
+ 'example': 'Extension'
+ },
+ {'name': 'req1'}
+ ],
+ 'recommended': [
+ {'name': 'rec0'},
+ {'name': 'rec1'}
+ ],
+ 'only_one': [
+ {'name': 'only0'}
+ ],
+ 'optional': [
+ {'name': 'free1'},
+ {
+ 'name': 'opt0',
+ 'is_last': True
+ }
+ ]
+ }
+
+ expected_apps = {
+ 'required': [
+ {
+ 'name': 'req0',
+ 'example': 'Application'
+ },
+ {'name': 'req1'}
+ ],
+ 'recommended': [
+ {'name': 'rec1'}
+ ],
+ 'only_one': [
+ {'name': 'only0'},
+ {'name': 'only1'}
+ ],
+ 'optional': [
+ {'name': 'free0'},
+ {
+ 'name': 'free1',
+ 'is_last': True
+ }
+ ]
+ }
+
+ mds = ManifestDataSource(
+ CompiledFileSystem.Factory(file_system, ObjectStoreCreator.ForTest()),
+ file_system, 'manifest.json', '_manifest_features.json')
+
+ self.assertEqual(expected_extensions, mds.get('extensions'))
+ self.assertEqual(expected_apps, mds.get('apps'))
+
+if __name__ == '__main__':
+ unittest.main()

Powered by Google App Engine
This is Rietveld 408576698