| 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 |
| 11 from extensions_paths import API_PATHS, CHROME_API, CHROME_EXTENSIONS | 11 from extensions_paths import (API_PATHS, CHROME_API, CHROME_EXTENSIONS, |
| 12 EXTENSIONS_API) |
| 12 from features_bundle import FeaturesBundle | 13 from features_bundle import FeaturesBundle |
| 13 from file_system import FileNotFoundError | 14 from file_system import FileNotFoundError |
| 14 from mock_file_system import MockFileSystem | 15 from mock_file_system import MockFileSystem |
| 15 from object_store_creator import ObjectStoreCreator | 16 from object_store_creator import ObjectStoreCreator |
| 16 from test_file_system import TestFileSystem | 17 from test_file_system import TestFileSystem |
| 17 from test_util import ReadFile | 18 from test_util import ReadFile |
| 18 from future import Future | 19 from future import Future |
| 19 from schema_processor import SchemaProcessorFactoryForTest | 20 from schema_processor import SchemaProcessorFactoryForTest |
| 20 | 21 |
| 21 | 22 |
| 22 _TEST_DATA = { | 23 _TEST_DATA = { |
| 23 'api': { | 24 'api': { |
| 24 'devtools': { | 25 'devtools': { |
| 25 'inspected_window.json': ReadFile( | 26 'inspected_window.json': ReadFile( |
| 26 CHROME_API, 'devtools', 'inspected_window.json'), | 27 CHROME_API, 'devtools', 'inspected_window.json'), |
| 27 }, | 28 }, |
| 28 '_api_features.json': json.dumps({ | 29 '_api_features.json': json.dumps({ |
| 29 'alarms': {}, | 30 'alarms': {}, |
| 30 'app': {}, | 31 'app': {}, |
| 31 'app.runtime': {'noparent': True}, | 32 'app.runtime': {'noparent': True}, |
| 32 'app.runtime.foo': {}, | 33 'app.runtime.foo': {}, |
| 33 'declarativeWebRequest': {}, | 34 'declarativeWebRequest': {}, |
| 34 'devtools.inspectedWindow': {}, | 35 'devtools.inspectedWindow': {}, |
| 35 'input': {}, | 36 'input': {}, |
| 36 'input.ime': {}, | 37 'input.ime': {}, |
| 37 'storage': {}, | 38 'storage': {}, |
| 38 }), | 39 }), |
| 39 '_manifest_features.json': '{}', | 40 '_manifest_features.json': '{}', |
| 40 '_permission_features.json': '{}', | 41 '_permission_features.json': '{}', |
| 41 'alarms.idl': ReadFile(CHROME_API, 'alarms.idl'), | 42 'alarms.idl': ReadFile(EXTENSIONS_API, 'alarms.idl'), |
| 42 'input_ime.json': ReadFile(CHROME_API, 'input_ime.json'), | 43 'input_ime.json': ReadFile(CHROME_API, 'input_ime.json'), |
| 43 'page_action.json': ReadFile(CHROME_API, 'page_action.json'), | 44 'page_action.json': ReadFile(CHROME_API, 'page_action.json'), |
| 44 }, | 45 }, |
| 45 'docs': { | 46 'docs': { |
| 46 'templates': { | 47 'templates': { |
| 47 'json': { | 48 'json': { |
| 48 'manifest.json': '{}', | 49 'manifest.json': '{}', |
| 49 'permissions.json': '{}', | 50 'permissions.json': '{}', |
| 50 } | 51 } |
| 51 } | 52 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 # No reads (still cached). | 151 # No reads (still cached). |
| 151 future = self._api_models.GetModel('alarms') | 152 future = self._api_models.GetModel('alarms') |
| 152 self.assertTrue(*self._mock_file_system.CheckAndReset( | 153 self.assertTrue(*self._mock_file_system.CheckAndReset( |
| 153 stat_count=len(API_PATHS)*2)) | 154 stat_count=len(API_PATHS)*2)) |
| 154 future.Get() | 155 future.Get() |
| 155 self.assertTrue(*self._mock_file_system.CheckAndReset()) | 156 self.assertTrue(*self._mock_file_system.CheckAndReset()) |
| 156 | 157 |
| 157 | 158 |
| 158 if __name__ == '__main__': | 159 if __name__ == '__main__': |
| 159 unittest.main() | 160 unittest.main() |
| OLD | NEW |