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.Factory() | 18 object_store_creator_factory = ObjectStoreCreator.Factory() |
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_factory) |
22 self._example_zipper = ExampleZipper( | 22 self._example_zipper = ExampleZipper( |
23 self._file_system, | |
24 CompiledFileSystem.Factory(self._file_system, | 23 CompiledFileSystem.Factory(self._file_system, |
25 object_store_creator_factory), | 24 object_store_creator_factory), |
26 'example_zipper') | 25 'example_zipper') |
27 | 26 |
28 def testCreateZip(self): | 27 def testCreateZip(self): |
29 # Cache manifest.json as unicode and make sure ExampleZipper doesn't error. | 28 # Cache manifest.json as unicode and make sure ExampleZipper doesn't error. |
30 self._file_system.ReadSingle('example_zipper/basic/manifest.json') | 29 self._file_system.ReadSingle('example_zipper/basic/manifest.json') |
31 self.assertTrue(len(self._example_zipper.Create('basic')) > 0) | 30 self.assertTrue(len(self._example_zipper.Create('basic')) > 0) |
32 | 31 |
33 if __name__ == '__main__': | 32 if __name__ == '__main__': |
34 unittest.main() | 33 unittest.main() |
OLD | NEW |