| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from api_categorizer import APICategorizer | 5 from api_categorizer import APICategorizer |
| 6 from api_data_source import APIDataSource | 6 from api_data_source import APIDataSource |
| 7 from api_list_data_source import APIListDataSource | 7 from api_list_data_source import APIListDataSource |
| 8 from api_models import APIModels | 8 from api_models import APIModels |
| 9 from availability_finder import AvailabilityFinder | 9 from availability_finder import AvailabilityFinder |
| 10 from compiled_file_system import CompiledFileSystem | 10 from compiled_file_system import CompiledFileSystem |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 self.compiled_fs_factory = compiled_fs_factory | 60 self.compiled_fs_factory = compiled_fs_factory |
| 61 | 61 |
| 62 self.host_file_system_provider = host_file_system_provider | 62 self.host_file_system_provider = host_file_system_provider |
| 63 host_fs_at_trunk = host_file_system_provider.GetTrunk() | 63 host_fs_at_trunk = host_file_system_provider.GetTrunk() |
| 64 | 64 |
| 65 self.github_file_system_provider = github_file_system_provider | 65 self.github_file_system_provider = github_file_system_provider |
| 66 | 66 |
| 67 assert base_path.startswith('/') and base_path.endswith('/') | 67 assert base_path.startswith('/') and base_path.endswith('/') |
| 68 self.base_path = base_path | 68 self.base_path = base_path |
| 69 | 69 |
| 70 self.document_renderer = DocumentRenderer(TableOfContentsRenderer( | |
| 71 host_fs_at_trunk, | |
| 72 compiled_fs_factory)) | |
| 73 | |
| 74 self.host_file_system_iterator = HostFileSystemIterator( | 70 self.host_file_system_iterator = HostFileSystemIterator( |
| 75 host_file_system_provider, | 71 host_file_system_provider, |
| 76 branch_utility) | 72 branch_utility) |
| 77 | 73 |
| 78 self.features_bundle = FeaturesBundle( | 74 self.features_bundle = FeaturesBundle( |
| 79 host_fs_at_trunk, | 75 host_fs_at_trunk, |
| 80 self.compiled_fs_factory, | 76 self.compiled_fs_factory, |
| 81 self.object_store_creator) | 77 self.object_store_creator) |
| 82 | 78 |
| 83 self.api_models = APIModels( | 79 self.api_models = APIModels( |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 self.content_providers = ContentProviders( | 142 self.content_providers = ContentProviders( |
| 147 self.compiled_fs_factory, | 143 self.compiled_fs_factory, |
| 148 host_fs_at_trunk, | 144 host_fs_at_trunk, |
| 149 self.github_file_system_provider) | 145 self.github_file_system_provider) |
| 150 | 146 |
| 151 # TODO(kalman): Move all the remaining DataSources into DataSourceRegistry, | 147 # TODO(kalman): Move all the remaining DataSources into DataSourceRegistry, |
| 152 # then factor out the DataSource creation into a factory method, so that | 148 # then factor out the DataSource creation into a factory method, so that |
| 153 # the entire ServerInstance doesn't need to be passed in here. | 149 # the entire ServerInstance doesn't need to be passed in here. |
| 154 self.template_renderer = TemplateRenderer(self) | 150 self.template_renderer = TemplateRenderer(self) |
| 155 | 151 |
| 152 # TODO(kalman): It may be better for |document_renderer| to construct a |
| 153 # TemplateDataSource itself rather than depending on template_renderer, but |
| 154 # for that the above todo should be addressed. |
| 155 self.document_renderer = DocumentRenderer(TableOfContentsRenderer( |
| 156 host_fs_at_trunk, |
| 157 compiled_fs_factory, |
| 158 self.template_renderer)) |
| 159 |
| 156 @staticmethod | 160 @staticmethod |
| 157 def ForTest(file_system=None, file_system_provider=None, base_path='/'): | 161 def ForTest(file_system=None, file_system_provider=None, base_path='/'): |
| 158 object_store_creator = ObjectStoreCreator.ForTest() | 162 object_store_creator = ObjectStoreCreator.ForTest() |
| 159 if file_system is None and file_system_provider is None: | 163 if file_system is None and file_system_provider is None: |
| 160 raise ValueError('Either |file_system| or |file_system_provider| ' | 164 raise ValueError('Either |file_system| or |file_system_provider| ' |
| 161 'must be specified') | 165 'must be specified') |
| 162 if file_system and file_system_provider: | 166 if file_system and file_system_provider: |
| 163 raise ValueError('Only one of |file_system| and |file_system_provider| ' | 167 raise ValueError('Only one of |file_system| and |file_system_provider| ' |
| 164 'can be specified') | 168 'can be specified') |
| 165 if file_system_provider is None: | 169 if file_system_provider is None: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 178 object_store_creator = ObjectStoreCreator(start_empty=False, | 182 object_store_creator = ObjectStoreCreator(start_empty=False, |
| 179 store_type=TestObjectStore) | 183 store_type=TestObjectStore) |
| 180 host_file_system_provider = HostFileSystemProvider.ForLocal( | 184 host_file_system_provider = HostFileSystemProvider.ForLocal( |
| 181 object_store_creator) | 185 object_store_creator) |
| 182 return ServerInstance( | 186 return ServerInstance( |
| 183 object_store_creator, | 187 object_store_creator, |
| 184 CompiledFileSystem.Factory(object_store_creator), | 188 CompiledFileSystem.Factory(object_store_creator), |
| 185 TestBranchUtility.CreateWithCannedData(), | 189 TestBranchUtility.CreateWithCannedData(), |
| 186 host_file_system_provider, | 190 host_file_system_provider, |
| 187 GithubFileSystemProvider.ForEmpty()) | 191 GithubFileSystemProvider.ForEmpty()) |
| OLD | NEW |