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