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 |
11 from compiled_file_system import CompiledFileSystem | 11 from compiled_file_system import CompiledFileSystem |
12 from example_zipper import ExampleZipper | 12 from example_zipper import ExampleZipper |
13 from local_file_system import LocalFileSystem | 13 from local_file_system import LocalFileSystem |
14 from object_store_creator import ObjectStoreCreator | 14 from object_store_creator import ObjectStoreCreator |
15 | 15 |
16 class ExampleZipperTest(unittest.TestCase): | 16 class ExampleZipperTest(unittest.TestCase): |
17 def setUp(self): | 17 def setUp(self): |
18 object_store_creator_factory = ObjectStoreCreator.TestFactory() | 18 object_store_creator = ObjectStoreCreator.ForTest() |
19 self._file_system = CachingFileSystem( | 19 self._file_system = CachingFileSystem( |
20 LocalFileSystem(os.path.join(sys.path[0], 'test_data')), | 20 LocalFileSystem(os.path.join(sys.path[0], 'test_data')), |
21 object_store_creator_factory) | 21 object_store_creator) |
22 self._example_zipper = ExampleZipper( | 22 self._example_zipper = ExampleZipper( |
23 CompiledFileSystem.Factory(self._file_system, | 23 CompiledFileSystem.Factory(self._file_system, object_store_creator), |
24 object_store_creator_factory), | |
25 'example_zipper') | 24 'example_zipper') |
26 | 25 |
27 def testCreateZip(self): | 26 def testCreateZip(self): |
28 # Cache manifest.json as unicode and make sure ExampleZipper doesn't error. | 27 # Cache manifest.json as unicode and make sure ExampleZipper doesn't error. |
29 self._file_system.ReadSingle('example_zipper/basic/manifest.json') | 28 self._file_system.ReadSingle('example_zipper/basic/manifest.json') |
30 self.assertTrue(len(self._example_zipper.Create('basic')) > 0) | 29 self.assertTrue(len(self._example_zipper.Create('basic')) > 0) |
31 | 30 |
32 if __name__ == '__main__': | 31 if __name__ == '__main__': |
33 unittest.main() | 32 unittest.main() |
OLD | NEW |