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

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

Issue 14247024: Devserver: allow SubversionFileSystem to be pinned to a specific rev on construction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/docs/server2/svn_constants.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 file_system import FileSystem, FileNotFoundError, StatInfo 5 from file_system import FileSystem, FileNotFoundError, StatInfo
6 from future import Future 6 from future import Future
7 7
8 class TestFileSystem(FileSystem): 8 class TestFileSystem(FileSystem):
9 '''A FileSystem backed by an object. Create with an object representing file 9 '''A FileSystem backed by an object. Create with an object representing file
10 paths such that {'a': {'b': 'hello'}} will resolve Read('a/b') as 'hello', 10 paths such that {'a': {'b': 'hello'}} will resolve Read('a/b') as 'hello',
(...skipping 10 matching lines...) Expand all
21 ''' 21 '''
22 result = {} 22 result = {}
23 leaf = result 23 leaf = result
24 for k in base.split('/'): 24 for k in base.split('/'):
25 leaf[k] = {} 25 leaf[k] = {}
26 leaf = leaf[k] 26 leaf = leaf[k]
27 leaf.update(obj) 27 leaf.update(obj)
28 return result 28 return result
29 29
30 def __init__(self, obj): 30 def __init__(self, obj):
31 assert obj is not None
31 self._obj = obj 32 self._obj = obj
32 self._path_stats = {} 33 self._path_stats = {}
33 self._global_stat = 0 34 self._global_stat = 0
34 35
35 # 36 #
36 # FileSystem implementation. 37 # FileSystem implementation.
37 # 38 #
38 39
39 def Read(self, paths, binary=False): 40 def Read(self, paths, binary=False):
40 test_fs = self 41 test_fs = self
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 # 108 #
108 109
109 def IncrementStat(self, path=None): 110 def IncrementStat(self, path=None):
110 if path is not None: 111 if path is not None:
111 self._path_stats[path] = self._path_stats.get(path, 0) + 1 112 self._path_stats[path] = self._path_stats.get(path, 0) + 1
112 else: 113 else:
113 self._global_stat += 1 114 self._global_stat += 1
114 115
115 def GetIdentity(self): 116 def GetIdentity(self):
116 return self.__class__.__name__ 117 return self.__class__.__name__
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/svn_constants.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698