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

Unified Diff: headless/lib/browser/client_api_generator_unittest.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 | « headless/lib/browser/client_api_generator.py ('k') | headless/lib/browser/domain_cc.template » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/browser/client_api_generator_unittest.py
diff --git a/headless/lib/browser/client_api_generator_unittest.py b/headless/lib/browser/client_api_generator_unittest.py
index 5c298bdd7046f662544333af268745425c84b122..0cd7df3fd37968ffd63ed4cee18716c0c025a422 100644
--- a/headless/lib/browser/client_api_generator_unittest.py
+++ b/headless/lib/browser/client_api_generator_unittest.py
@@ -349,6 +349,105 @@ class ClientApiGeneratorTest(unittest.TestCase):
types = json_api['domains'][0]['types']
self.assertListEqual(types, expected_types)
+ def test_PatchHiddenDomains(self):
+ json_api = {
+ 'domains': [
+ {
+ 'domain': 'domain',
+ 'hidden': True,
+ 'commands': [
+ {
+ 'name': 'FooCommand',
+ }
+ ],
+ 'events': [
+ {
+ 'name': 'BarEvent',
+ }
+ ]
+ }
+ ]
+ }
+ expected_types = [
+ {
+ 'type': 'object',
+ 'id': 'FooCommandParams',
+ 'description': 'Parameters for the FooCommand command.',
+ 'properties': [],
+ },
+ {
+ 'type': 'object',
+ 'id': 'FooCommandResult',
+ 'description': 'Result for the FooCommand command.',
+ 'properties': [],
+ },
+ {
+ 'type': 'object',
+ 'id': 'BarEventParams',
+ 'description': 'Parameters for the BarEvent event.',
+ 'properties': [],
+ }
+ ]
+ client_api_generator.PatchHiddenCommandsAndEvents(json_api)
+ client_api_generator.SynthesizeCommandTypes(json_api)
+ client_api_generator.SynthesizeEventTypes(json_api)
+ for command in json_api['domains'][0]['commands']:
+ self.assertTrue(command['hidden'])
+ for event in json_api['domains'][0]['events']:
+ self.assertTrue(command['hidden'])
+ types = json_api['domains'][0]['types']
+ self.assertListEqual(types, expected_types)
+
+ def test_PatchHiddenCommandsAndEvents(self):
+ json_api = {
+ 'domains': [
+ {
+ 'domain': 'domain',
+ 'commands': [
+ {
+ 'name': 'FooCommand',
+ 'hidden': True,
+ }
+ ],
+ 'events': [
+ {
+ 'name': 'BarEvent',
+ 'hidden': True,
+ }
+ ]
+ }
+ ]
+ }
+ expected_types = [
+ {
+ 'type': 'object',
+ 'id': 'FooCommandParams',
+ 'description': 'Parameters for the FooCommand command.',
+ 'properties': [],
+ },
+ {
+ 'type': 'object',
+ 'id': 'FooCommandResult',
+ 'description': 'Result for the FooCommand command.',
+ 'properties': [],
+ },
+ {
+ 'type': 'object',
+ 'id': 'BarEventParams',
+ 'description': 'Parameters for the BarEvent event.',
+ 'properties': [],
+ }
+ ]
+ client_api_generator.PatchHiddenCommandsAndEvents(json_api)
+ client_api_generator.SynthesizeCommandTypes(json_api)
+ client_api_generator.SynthesizeEventTypes(json_api)
+ for command in json_api['domains'][0]['commands']:
+ self.assertTrue(command['hidden'])
+ for event in json_api['domains'][0]['events']:
+ self.assertTrue(command['hidden'])
+ types = json_api['domains'][0]['types']
+ self.assertListEqual(types, expected_types)
+
def test_Generate(self):
json_api = {
'domains': [
« no previous file with comments | « headless/lib/browser/client_api_generator.py ('k') | headless/lib/browser/domain_cc.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698