| Index: chrome/common/extensions/docs/server2/compiled_file_system_test.py | 
| diff --git a/chrome/common/extensions/docs/server2/compiled_file_system_test.py b/chrome/common/extensions/docs/server2/compiled_file_system_test.py | 
| index 65dacfc123522174d961449e634bd254a9207bd5..43d8da0eabb451467a15e1855b216ad5b58d1fcc 100755 | 
| --- a/chrome/common/extensions/docs/server2/compiled_file_system_test.py | 
| +++ b/chrome/common/extensions/docs/server2/compiled_file_system_test.py | 
| @@ -3,6 +3,7 @@ | 
| # Use of this source code is governed by a BSD-style license that can be | 
| # found in the LICENSE file. | 
|  | 
| +import functools | 
| import os | 
|  | 
| from appengine_wrappers import GetAppVersion | 
| @@ -39,19 +40,24 @@ _TEST_DATA = { | 
|  | 
| identity = lambda _, x: x | 
|  | 
| -def _CreateFactory(): | 
| -  return CompiledFileSystem.Factory( | 
| -      TestFileSystem(deepcopy(_TEST_DATA)), | 
| -      ObjectStoreCreator(start_empty=False, | 
| -                         store_type=TestObjectStore, | 
| -                         disable_wrappers=True)) | 
| +def _GetTestCompiledFsCreator(): | 
| +  '''Returns a function which creates CompiledFileSystem views of | 
| +  TestFileSystems backed by _TEST_DATA. | 
| +  ''' | 
| +  return functools.partial( | 
| +      CompiledFileSystem.Factory( | 
| +          ObjectStoreCreator(start_empty=False, | 
| +                             store_type=TestObjectStore, | 
| +                             disable_wrappers=True), | 
| +      ).Create, | 
| +      TestFileSystem(deepcopy(_TEST_DATA))) | 
|  | 
| class CompiledFileSystemTest(unittest.TestCase): | 
| def testPopulateNamespace(self): | 
| def CheckNamespace(expected_file, expected_list, fs): | 
| self.assertEqual(expected_file, fs._file_object_store.namespace) | 
| self.assertEqual(expected_list, fs._list_object_store.namespace) | 
| -    factory = _CreateFactory() | 
| +    compiled_fs_creator = _GetTestCompiledFsCreator() | 
| f = lambda x: x | 
| CheckNamespace( | 
| 'class=CompiledFileSystem&' | 
| @@ -60,7 +66,7 @@ class CompiledFileSystemTest(unittest.TestCase): | 
| 'class=CompiledFileSystem&' | 
| 'category=CompiledFileSystemTest/TestFileSystem/list&' | 
| 'app_version=%s' % GetAppVersion(), | 
| -        factory.Create(f, CompiledFileSystemTest)) | 
| +        compiled_fs_creator(f, CompiledFileSystemTest)) | 
| CheckNamespace( | 
| 'class=CompiledFileSystem&' | 
| 'category=CompiledFileSystemTest/TestFileSystem/foo/file&' | 
| @@ -68,12 +74,12 @@ class CompiledFileSystemTest(unittest.TestCase): | 
| 'class=CompiledFileSystem&' | 
| 'category=CompiledFileSystemTest/TestFileSystem/foo/list&' | 
| 'app_version=%s' % GetAppVersion(), | 
| -        factory.Create(f, CompiledFileSystemTest, category='foo')) | 
| +        compiled_fs_creator(f, CompiledFileSystemTest, category='foo')) | 
|  | 
| def testPopulateFromFile(self): | 
| def Sleepy(key, val): | 
| return '%s%s' % ('Z' * len(key), 'z' * len(val)) | 
| -    compiled_fs = _CreateFactory().Create(Sleepy, CompiledFileSystemTest) | 
| +    compiled_fs = _GetTestCompiledFsCreator()(Sleepy, CompiledFileSystemTest) | 
| self.assertEqual('ZZZZZZZZzzzzzzzzzzzzzzzzz', | 
| compiled_fs.GetFromFile('404.html').Get()) | 
| self.assertEqual('ZZZZZZZZZZZZZZzzzzzzzzzzzzzzzzzz', | 
| @@ -84,8 +90,7 @@ class CompiledFileSystemTest(unittest.TestCase): | 
| def testPopulateFromFileListing(self): | 
| def strip_ext(path, files): | 
| return [os.path.splitext(f)[0] for f in files] | 
| - | 
| -    compiled_fs = _CreateFactory().Create(strip_ext, CompiledFileSystemTest) | 
| +    compiled_fs = _GetTestCompiledFsCreator()(strip_ext, CompiledFileSystemTest) | 
| expected_top_listing = [ | 
| '404', | 
| 'apps/a11y', | 
| @@ -129,7 +134,7 @@ class CompiledFileSystemTest(unittest.TestCase): | 
| 'apps/deepdir/deeper/').Get()) | 
|  | 
| def testCaching(self): | 
| -    compiled_fs = _CreateFactory().Create(identity, CompiledFileSystemTest) | 
| +    compiled_fs = _GetTestCompiledFsCreator()(identity, CompiledFileSystemTest) | 
| self.assertEqual('404.html contents', | 
| compiled_fs.GetFromFile('404.html').Get()) | 
| self.assertEqual(set(('file.html',)), | 
| @@ -148,7 +153,7 @@ class CompiledFileSystemTest(unittest.TestCase): | 
| set(compiled_fs.GetFromFileListing('apps/fakedir').Get())) | 
|  | 
| def testFailures(self): | 
| -    compiled_fs = _CreateFactory().Create(identity, CompiledFileSystemTest) | 
| +    compiled_fs = _GetTestCompiledFsCreator()(identity, CompiledFileSystemTest) | 
| self.assertRaises(FileNotFoundError, | 
| compiled_fs.GetFromFile('405.html').Get) | 
| # TODO(kalman): would be nice to test this fails since apps/ is a dir. | 
| @@ -166,8 +171,8 @@ class CompiledFileSystemTest(unittest.TestCase): | 
| # resolved until Get is. | 
| mock_fs = MockFileSystem(TestFileSystem(_TEST_DATA)) | 
| compiled_fs = CompiledFileSystem.Factory( | 
| -        mock_fs, ObjectStoreCreator.ForTest()).Create( | 
| -            lambda path, contents: contents, type(self)) | 
| +        ObjectStoreCreator.ForTest()).Create( | 
| +            mock_fs, lambda path, contents: contents, type(self)) | 
|  | 
| self.assertTrue(*mock_fs.CheckAndReset()) | 
| future = compiled_fs.GetFromFile('404.html') | 
|  |