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

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

Issue 151883009: Docserver: Make MockFileSystem not iterate over the entire file system as part (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: yoz and then some Created 6 years, 10 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 | « no previous file | chrome/common/extensions/docs/server2/chained_compiled_file_system_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 os 6 import os
7 import sys 7 import sys
8 import unittest 8 import unittest
9 9
10 from caching_file_system import CachingFileSystem 10 from caching_file_system import CachingFileSystem
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 file_system._read_object_store.Del('bob/bob1') 130 file_system._read_object_store.Del('bob/bob1')
131 futures = (file_system.ReadSingle('bob/bob1'), 131 futures = (file_system.ReadSingle('bob/bob1'),
132 file_system.ReadSingle('bob/bob2'), 132 file_system.ReadSingle('bob/bob2'),
133 file_system.ReadSingle('bob/bob3')) 133 file_system.ReadSingle('bob/bob3'))
134 self.assertTrue(*mock_fs.CheckAndReset(read_count=3, stat_count=1)) 134 self.assertTrue(*mock_fs.CheckAndReset(read_count=3, stat_count=1))
135 self.assertEqual( 135 self.assertEqual(
136 ('bob/bob1 contents', 'bob/bob2 contents', 'bob/bob3 contents'), 136 ('bob/bob1 contents', 'bob/bob2 contents', 'bob/bob3 contents'),
137 tuple(future.Get() for future in futures)) 137 tuple(future.Get() for future in futures))
138 self.assertTrue(*mock_fs.CheckAndReset(read_resolve_count=3)) 138 self.assertTrue(*mock_fs.CheckAndReset(read_resolve_count=3))
139 139
140 test_fs.IncrementStat(path='bob/') 140 test_fs.IncrementStat(path='bob/bob0')
141 file_system = create_empty_caching_fs() 141 file_system = create_empty_caching_fs()
142 self.assertEqual('bob/bob1 contents', 142 self.assertEqual('bob/bob1 contents',
143 file_system.ReadSingle('bob/bob1').Get()) 143 file_system.ReadSingle('bob/bob1').Get())
144 self.assertEqual('bob/bob2 contents', 144 self.assertEqual('bob/bob2 contents',
145 file_system.ReadSingle('bob/bob2').Get()) 145 file_system.ReadSingle('bob/bob2').Get())
146 self.assertEqual('bob/bob3 contents', 146 self.assertEqual('bob/bob3 contents',
147 file_system.ReadSingle('bob/bob3').Get()) 147 file_system.ReadSingle('bob/bob3').Get())
148 self.assertTrue(*mock_fs.CheckAndReset(stat_count=1)) 148 self.assertTrue(*mock_fs.CheckAndReset(stat_count=1))
149 149
150 file_system = create_empty_caching_fs() 150 file_system = create_empty_caching_fs()
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 self.assertTrue(*mock_fs.CheckAndReset()) 212 self.assertTrue(*mock_fs.CheckAndReset())
213 run() 213 run()
214 run() 214 run()
215 215
216 run_expecting_stat('0') 216 run_expecting_stat('0')
217 test_fs.IncrementStat() 217 test_fs.IncrementStat()
218 run_expecting_stat('1') 218 run_expecting_stat('1')
219 219
220 if __name__ == '__main__': 220 if __name__ == '__main__':
221 unittest.main() 221 unittest.main()
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/chained_compiled_file_system_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698