OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 json | 6 import json |
7 import unittest | 7 import unittest |
8 | 8 |
9 from api_models import APIModels | 9 from api_models import APIModels |
10 from compiled_file_system import CompiledFileSystem | 10 from compiled_file_system import CompiledFileSystem |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 compiled_fs_factory = CompiledFileSystem.Factory(object_store_creator) | 59 compiled_fs_factory = CompiledFileSystem.Factory(object_store_creator) |
60 self._mock_file_system = MockFileSystem( | 60 self._mock_file_system = MockFileSystem( |
61 TestFileSystem(_TEST_DATA, relative_to=CHROME_EXTENSIONS)) | 61 TestFileSystem(_TEST_DATA, relative_to=CHROME_EXTENSIONS)) |
62 features_bundle = FeaturesBundle(self._mock_file_system, | 62 features_bundle = FeaturesBundle(self._mock_file_system, |
63 compiled_fs_factory, | 63 compiled_fs_factory, |
64 object_store_creator, | 64 object_store_creator, |
65 'extensions') | 65 'extensions') |
66 self._api_models = APIModels(features_bundle, | 66 self._api_models = APIModels(features_bundle, |
67 compiled_fs_factory, | 67 compiled_fs_factory, |
68 self._mock_file_system, | 68 self._mock_file_system, |
| 69 object_store_creator, |
69 'extensions') | 70 'extensions') |
70 | 71 |
71 def testGetNames(self): | 72 def testGetNames(self): |
72 # Both 'app' and 'app.runtime' appear here because 'app.runtime' has | 73 # Both 'app' and 'app.runtime' appear here because 'app.runtime' has |
73 # noparent:true, but 'app.runtime.foo' etc doesn't so it's a sub-feature of | 74 # noparent:true, but 'app.runtime.foo' etc doesn't so it's a sub-feature of |
74 # 'app.runtime' not a separate API. 'devtools.inspectedWindow' is an API | 75 # 'app.runtime' not a separate API. 'devtools.inspectedWindow' is an API |
75 # because there is no 'devtools'. | 76 # because there is no 'devtools'. |
76 self.assertEqual( | 77 self.assertEqual( |
77 ['alarms', 'app', 'app.runtime', 'declarativeWebRequest', | 78 ['alarms', 'app', 'app.runtime', 'declarativeWebRequest', |
78 'devtools.inspectedWindow', 'input', 'storage'], | 79 'devtools.inspectedWindow', 'input', 'storage'], |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 # No reads (still cached). | 148 # No reads (still cached). |
148 future = self._api_models.GetModel('alarms') | 149 future = self._api_models.GetModel('alarms') |
149 self.assertTrue(*self._mock_file_system.CheckAndReset( | 150 self.assertTrue(*self._mock_file_system.CheckAndReset( |
150 stat_count=len(API_PATHS)*2)) | 151 stat_count=len(API_PATHS)*2)) |
151 future.Get() | 152 future.Get() |
152 self.assertTrue(*self._mock_file_system.CheckAndReset()) | 153 self.assertTrue(*self._mock_file_system.CheckAndReset()) |
153 | 154 |
154 | 155 |
155 if __name__ == '__main__': | 156 if __name__ == '__main__': |
156 unittest.main() | 157 unittest.main() |
OLD | NEW |