| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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() |
| OLD | NEW |