Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 object_store_creator import ObjectStoreCreator | 10 from object_store_creator import ObjectStoreCreator |
| 11 from permissions_data_source import PermissionsDataSource | 11 from permissions_data_source import PermissionsDataSource |
| 12 from test_file_system import TestFileSystem | 12 from test_file_system import TestFileSystem |
| 13 | 13 |
| 14 class FakeTemplateDataSource(object): | 14 class FakeTemplateDataSource(object): |
| 15 class Factory(): | 15 class Factory(): |
| 16 def Create(self, *args): | 16 def Create(self, *args): |
| 17 return FakeTemplateDataSource() | 17 return FakeTemplateDataSource() |
| 18 def get(self, key): | 18 def get(self, key): |
| 19 return 'partial ' + key | 19 return 'partial ' + key |
| 20 | 20 |
| 21 file_system = TestFileSystem({ | 21 file_system = TestFileSystem({ |
|
Jeffrey Yasskin
2013/08/30 19:55:47
This file system is odd. It's rooted at a mixture
not at google - send to devlin
2013/08/30 20:35:33
It might look odd but it makes the most sense.
- i
| |
| 22 'permissions.json': json.dumps({ | 22 'permissions.json': json.dumps({ |
| 23 'host-permissions': { | 23 'host-permissions': { |
| 24 'name': 'match pattern', | 24 'name': 'match pattern', |
| 25 'anchor': 'custom-anchor', | 25 'anchor': 'custom-anchor', |
| 26 'platforms': ['app', 'extension'], | 26 'platforms': ['app', 'extension'], |
| 27 'partial': 'host_permissions.html', | 27 'partial': 'host_permissions.html', |
| 28 'literal_name': True | 28 'literal_name': True |
| 29 }, | 29 }, |
| 30 'activeTab': { | 30 'activeTab': { |
| 31 'partial': 'active_tab.html' | 31 'partial': 'active_tab.html' |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 56 'commandLinePrivate': { | 56 'commandLinePrivate': { |
| 57 'extension_types': 'all' | 57 'extension_types': 'all' |
| 58 }, | 58 }, |
| 59 'cookies': { | 59 'cookies': { |
| 60 'extension_types': ['platform_app'] | 60 'extension_types': ['platform_app'] |
| 61 } | 61 } |
| 62 }), | 62 }), |
| 63 '_api_features.json': json.dumps({ | 63 '_api_features.json': json.dumps({ |
| 64 'cookies': { | 64 'cookies': { |
| 65 'dependencies': ['permission:cookies'] | 65 'dependencies': ['permission:cookies'] |
| 66 }, | |
| 67 'alarms': { | |
| 68 'dependencies': ['permission:alarms'] | |
| 66 } | 69 } |
| 67 }) | 70 }) |
| 68 }) | 71 }) |
| 69 | 72 |
| 70 class PermissionsDataSourceTest(unittest.TestCase): | 73 class PermissionsDataSourceTest(unittest.TestCase): |
| 71 def testCreatePermissionsDataSource(self): | 74 def testCreatePermissionsDataSource(self): |
| 72 expected_extensions = [ | 75 expected_extensions = [ |
| 73 { | 76 { |
| 74 'name': 'activeTab', | 77 'name': 'activeTab', |
| 75 'anchor': 'activeTab', | 78 'anchor': 'activeTab', |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 | 140 |
| 138 self.assertEqual( | 141 self.assertEqual( |
| 139 expected_extensions, | 142 expected_extensions, |
| 140 permissions_data_source.get('declare_extensions')) | 143 permissions_data_source.get('declare_extensions')) |
| 141 self.assertEqual( | 144 self.assertEqual( |
| 142 expected_apps, | 145 expected_apps, |
| 143 permissions_data_source.get('declare_apps')) | 146 permissions_data_source.get('declare_apps')) |
| 144 | 147 |
| 145 if __name__ == '__main__': | 148 if __name__ == '__main__': |
| 146 unittest.main() | 149 unittest.main() |
| OLD | NEW |