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

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

Issue 26538009: Docserver: make file_system a property of Create (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: niggles Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 caching_file_system import CachingFileSystem 5 from caching_file_system import CachingFileSystem
6 from local_file_system import LocalFileSystem 6 from local_file_system import LocalFileSystem
7 from offline_file_system import OfflineFileSystem 7 from offline_file_system import OfflineFileSystem
8 from subversion_file_system import SubversionFileSystem 8 from subversion_file_system import SubversionFileSystem
9 from third_party.json_schema_compiler.memoize import memoize 9 from third_party.json_schema_compiler.memoize import memoize
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if self._constructor_for_test is not None: 85 if self._constructor_for_test is not None:
86 file_system = self._constructor_for_test(branch=branch, revision=revision) 86 file_system = self._constructor_for_test(branch=branch, revision=revision)
87 else: 87 else:
88 file_system = SubversionFileSystem.Create(branch=branch, 88 file_system = SubversionFileSystem.Create(branch=branch,
89 revision=revision) 89 revision=revision)
90 if self._offline: 90 if self._offline:
91 file_system = OfflineFileSystem(file_system) 91 file_system = OfflineFileSystem(file_system)
92 return CachingFileSystem(file_system, self._object_store_creator) 92 return CachingFileSystem(file_system, self._object_store_creator)
93 93
94 @staticmethod 94 @staticmethod
95 def ForLocal(object_store_creator): 95 def ForLocal(object_store_creator, **optargs):
96 '''Used in creating a server instance on localhost. 96 '''Used in creating a server instance on localhost.
97 ''' 97 '''
98 return HostFileSystemProvider( 98 return HostFileSystemProvider(
99 object_store_creator, 99 object_store_creator,
100 constructor_for_test=lambda **_: LocalFileSystem.Create()) 100 constructor_for_test=lambda **_: LocalFileSystem.Create(),
101 **optargs)
101 102
102 @staticmethod 103 @staticmethod
103 def ForTest(file_system, object_store_creator): 104 def ForTest(file_system, object_store_creator, **optargs):
104 '''Used in creating a test server instance. The HostFileSystemProvider 105 '''Used in creating a test server instance. The HostFileSystemProvider
105 returned here will always return |file_system| when its Create() method is 106 returned here will always return |file_system| when its Create() method is
106 called. 107 called.
107 ''' 108 '''
108 return HostFileSystemProvider( 109 return HostFileSystemProvider(
109 object_store_creator, 110 object_store_creator,
110 constructor_for_test=lambda **_: file_system) 111 constructor_for_test=lambda **_: file_system,
112 **optargs)
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/file_system.py ('k') | chrome/common/extensions/docs/server2/instance_servlet.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698