Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/api_data_source_test.py |
| diff --git a/chrome/common/extensions/docs/server2/api_data_source_test.py b/chrome/common/extensions/docs/server2/api_data_source_test.py |
| index 5e935880a600ab9b85baee322912324ae8337c6a..101c18277dbb87bba8f14ce802d32075f24dd739 100755 |
| --- a/chrome/common/extensions/docs/server2/api_data_source_test.py |
| +++ b/chrome/common/extensions/docs/server2/api_data_source_test.py |
| @@ -17,6 +17,8 @@ from file_system import FileNotFoundError |
| from local_file_system import LocalFileSystem |
| from object_store_creator import ObjectStoreCreator |
| from reference_resolver import ReferenceResolver |
| +import third_party.json_schema_compiler.idl_schema as idl_schema |
| +import third_party.json_schema_compiler.idl_parser as idl_parser |
| import third_party.json_schema_compiler.model as model |
|
jshumway
2013/04/25 01:48:37
The imports on lines 20 and 21 are no longer neede
|
| def _MakeLink(href, text): |
| @@ -48,10 +50,10 @@ class FakeAPIAndListDataSource(object): |
| class APIDataSourceTest(unittest.TestCase): |
| def setUp(self): |
| - self._base_path = os.path.join(sys.path[0], 'test_data', 'test_json') |
| + self._base_path = os.path.join(sys.path[0], 'test_data') |
| - def _ReadLocalFile(self, filename): |
| - with open(os.path.join(self._base_path, filename), 'r') as f: |
| + def _ReadLocalFile(self, filename, test_dir='test_json'): |
| + with open(os.path.join(self._base_path, test_dir, filename), 'r') as f: |
| return f.read() |
| def _CreateRefResolver(self, filename): |
| @@ -112,5 +114,14 @@ class APIDataSourceTest(unittest.TestCase): |
| _RemoveNoDocs(d) |
| self.assertEqual(self._LoadJSON('expected_nodoc.json'), d) |
| + def testInlineDocs(self): |
| + raw_idl = self._ReadLocalFile('inline.idl', test_dir='test_idl') |
| + idl = idl_parser.IDLParser().ParseData(raw_idl) |
| + jsc = _JSCModel( |
| + idl_schema.IDLSchema(idl).process()[0], |
| + None, True).ToDict() |
| + self.assertEqual(self._LoadJSON('expected_inline.json'), jsc) |
|
not at google - send to devlin
2013/04/25 00:19:35
still some things missing here e.g. making sure th
jshumway
2013/04/25 01:48:37
I see what you mean now. I removed the unnecessary
|
| + |
| + |
| if __name__ == '__main__': |
| unittest.main() |