Commit 653db950 authored by grv@chromium.org's avatar grv@chromium.org

Add INTERNAL annotation to namespaces in IDL


BUG=129311
TEST=unittest


Review URL: https://chromiumcodereview.appspot.com/10677015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149553 0039d316-1c4b-4281-b951-d872f2087c98
parent b1409cc1
...@@ -262,9 +262,11 @@ class Namespace(object): ...@@ -262,9 +262,11 @@ class Namespace(object):
dictionary that the JSON schema compiler expects to see. dictionary that the JSON schema compiler expects to see.
''' '''
def __init__(self, namespace_node, nodoc=False, permissions=None): def __init__(self, namespace_node, nodoc=False, permissions=None,
internal=False):
self.namespace = namespace_node self.namespace = namespace_node
self.nodoc = nodoc self.nodoc = nodoc
self.internal = internal
self.events = [] self.events = []
self.functions = [] self.functions = []
self.types = [] self.types = []
...@@ -291,6 +293,7 @@ class Namespace(object): ...@@ -291,6 +293,7 @@ class Namespace(object):
'documentation_permissions_required': self.permissions, 'documentation_permissions_required': self.permissions,
'types': self.types, 'types': self.types,
'functions': self.functions, 'functions': self.functions,
'internal': self.internal,
'events': self.events} 'events': self.events}
def process_interface(self, node): def process_interface(self, node):
...@@ -313,11 +316,14 @@ class IDLSchema(object): ...@@ -313,11 +316,14 @@ class IDLSchema(object):
def process(self): def process(self):
namespaces = [] namespaces = []
nodoc = False nodoc = False
internal = False
permissions = None permissions = None
for node in self.idl: for node in self.idl:
if node.cls == 'Namespace': if node.cls == 'Namespace':
namespace = Namespace(node, nodoc, permissions) namespace = Namespace(node, nodoc, permissions, internal)
namespaces.append(namespace.process()) namespaces.append(namespace.process())
nodoc = False
internal = False
elif node.cls == 'Copyright': elif node.cls == 'Copyright':
continue continue
elif node.cls == 'Comment': elif node.cls == 'Comment':
...@@ -327,6 +333,8 @@ class IDLSchema(object): ...@@ -327,6 +333,8 @@ class IDLSchema(object):
nodoc = bool(node.value) nodoc = bool(node.value)
elif node.name == 'permissions': elif node.name == 'permissions':
permission = node.value.split(',') permission = node.value.split(',')
elif node.name == 'internal':
internal = bool(node.value)
else: else:
continue continue
else: else:
......
...@@ -84,6 +84,12 @@ class IdlSchemaTest(unittest.TestCase): ...@@ -84,6 +84,12 @@ class IdlSchemaTest(unittest.TestCase):
self.assertTrue(func is not None) self.assertTrue(func is not None)
self.assertTrue(func['nocompile']) self.assertTrue(func['nocompile'])
def testInternalNamespace(self):
idl_basics = self.idl_basics
self.assertEquals('idl_basics', idl_basics['namespace'])
self.assertTrue(idl_basics['internal'])
self.assertFalse(idl_basics['nodoc'])
def testFunctionComment(self): def testFunctionComment(self):
schema = self.idl_basics schema = self.idl_basics
func = getFunction(schema, 'function3') func = getFunction(schema, 'function3')
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// Tests a variety of basic API definition features. // Tests a variety of basic API definition features.
namespace idl_basics { [internal] namespace idl_basics {
// Enum description // Enum description
enum EnumType { enum EnumType {
name1, name1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment