Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6325)

Unified Diff: chrome/common/extensions/docs/server2/api_data_source_test.py

Issue 14322003: Inline docs render properly in extensions doc server. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment and whitespace fixes Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 db1a7f5f2db72d01e10a8929fc30ecc7b450b47e..117d8dfa073b7dbc6e9a1d10ad9421b8b4b1a713 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
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,25 @@ 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()
+
+ try:
+ # Make sure that inlining worked by attempting to access the inner objects
+ # inline.
+ self.assertNotEqual(
+ jsc['functions'][0]['parameters'][0].get('enum_values'),
+ None)
+ self.assertNotEqual(jsc['functions'][2]['parameters'][0].get(
+ 'properties')[3].get('enum_values'),
+ None)
+ except KeyError:
+ self.assertEqual(True, False);
not at google - send to devlin 2013/04/24 19:36:11 Throwing an error will fail the test anyway...
jshumway 2013/04/25 00:06:58 not really sure what I was thinking there, fixed.
+
not at google - send to devlin 2013/04/24 19:36:11 I think it would be more valuable to test a JSON s
jshumway 2013/04/25 00:06:58 I have made it so
if __name__ == '__main__':
unittest.main()

Powered by Google App Engine
This is Rietveld 408576698