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

Side by Side Diff: tools/json_schema_compiler/idl_schema_test.py

Issue 10677015: Add INTERNAL annotation to namespaces in IDL (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 idl_schema 6 import idl_schema
7 import unittest 7 import unittest
8 8
9 def getFunction(schema, name): 9 def getFunction(schema, name):
10 for item in schema['functions']: 10 for item in schema['functions']:
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 expected = [{'items': {'$ref': 'idl_basics.EnumType'}, 'name': 'types', 77 expected = [{'items': {'$ref': 'idl_basics.EnumType'}, 'name': 'types',
78 'type': 'array'}] 78 'type': 'array'}]
79 self.assertEquals(expected, getParams(schema, 'function14')) 79 self.assertEquals(expected, getParams(schema, 'function14'))
80 80
81 def testNoCompile(self): 81 def testNoCompile(self):
82 schema = self.idl_basics 82 schema = self.idl_basics
83 func = getFunction(schema, 'function15') 83 func = getFunction(schema, 'function15')
84 self.assertTrue(func is not None) 84 self.assertTrue(func is not None)
85 self.assertTrue(func['nocompile']) 85 self.assertTrue(func['nocompile'])
86 86
87 def testInternalNamespace(self):
88 idl_basics = self.idl_basics
89 self.assertEquals('idl_basics', idl_basics['namespace'])
90 self.assertTrue(idl_basics['internal'])
91 self.assertFalse(idl_basics['nodoc'])
92
87 def testFunctionComment(self): 93 def testFunctionComment(self):
88 schema = self.idl_basics 94 schema = self.idl_basics
89 func = getFunction(schema, 'function3') 95 func = getFunction(schema, 'function3')
90 self.assertEquals(('This comment should appear in the documentation, ' 96 self.assertEquals(('This comment should appear in the documentation, '
91 'despite occupying multiple lines.'), 97 'despite occupying multiple lines.'),
92 func['description']) 98 func['description'])
93 self.assertEquals( 99 self.assertEquals(
94 [{'description': ('So should this comment about the argument. ' 100 [{'description': ('So should this comment about the argument. '
95 '<em>HTML</em> is fine too.'), 101 '<em>HTML</em> is fine too.'),
96 'name': 'arg', 102 'name': 'arg',
97 '$ref': 'idl_basics.MyType1'}], 103 '$ref': 'idl_basics.MyType1'}],
98 func['parameters']) 104 func['parameters'])
99 func = getFunction(schema, 'function4') 105 func = getFunction(schema, 'function4')
100 self.assertEquals(('This tests if \\\"double-quotes\\\" are escaped ' 106 self.assertEquals(('This tests if \\\"double-quotes\\\" are escaped '
101 'correctly.'), 107 'correctly.'),
102 func['description']) 108 func['description'])
103 109
104 if __name__ == '__main__': 110 if __name__ == '__main__':
105 unittest.main() 111 unittest.main()
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/idl_schema.py ('k') | tools/json_schema_compiler/test/idl_basics.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698