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

Unified Diff: headless/lib/browser/client_api_generator.py

Issue 1904073002: headless: Move hidden commands and events to experimental domains (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also require parameters for hidden commands where the entire domain isn't hidden Created 4 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
« no previous file with comments | « no previous file | headless/lib/browser/client_api_generator_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/browser/client_api_generator.py
diff --git a/headless/lib/browser/client_api_generator.py b/headless/lib/browser/client_api_generator.py
index 3903b1eab6b87c1d795a45b8ccdc82d2b1b28f16..40f1206d17b206eb0adf31233bd0ced994c0b3b8 100644
--- a/headless/lib/browser/client_api_generator.py
+++ b/headless/lib/browser/client_api_generator.py
@@ -353,6 +353,31 @@ def SynthesizeEventTypes(json_api):
domain['types'].append(event_type)
+def PatchHiddenCommandsAndEvents(json_api):
+ """
+ Mark all commands and events in hidden domains as hidden and make sure hidden
+ commands have at least empty parameters and return values.
+ """
+ for domain in json_api['domains']:
+ if domain.get('hidden', False):
+ for command in domain.get('commands', []):
+ command['hidden'] = True
+ for event in domain.get('events', []):
+ event['hidden'] = True
+ for command in domain.get('commands', []):
+ if not command.get('hidden', False):
+ continue
+ if not 'parameters' in command:
+ command['parameters'] = []
+ if not 'returns' in command:
+ command['returns'] = []
+ for event in domain.get('events', []):
+ if not event.get('hidden', False):
+ continue
+ if not 'parameters' in event:
+ event['parameters'] = []
+
+
def Generate(jinja_env, output_dirname, json_api, class_name, file_types):
template_context = {
'api': json_api,
@@ -387,6 +412,7 @@ def GenerateDomains(jinja_env, output_dirname, json_api, class_name,
if __name__ == '__main__':
json_api, output_dirname = ParseArguments(sys.argv[1:])
jinja_env = InitializeJinjaEnv(output_dirname)
+ PatchHiddenCommandsAndEvents(json_api)
SynthesizeCommandTypes(json_api)
SynthesizeEventTypes(json_api)
PatchFullQualifiedRefs(json_api)
« no previous file with comments | « no previous file | headless/lib/browser/client_api_generator_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698