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

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

Issue 1907533002: headless: Implement DevTools events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add parameters to all events 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 f3609d490f297a13364f6c8b00271b459f712c69..5c298bdd7046f662544333af268745425c84b122 100644
--- a/headless/lib/browser/client_api_generator_unittest.py
+++ b/headless/lib/browser/client_api_generator_unittest.py
@@ -300,6 +300,55 @@ class ClientApiGeneratorTest(unittest.TestCase):
types = json_api['domains'][0]['types']
self.assertListEqual(types, expected_types)
+ def test_SynthesizeEventTypes(self):
+ json_api = {
+ 'domains': [
+ {
+ 'domain': 'domain',
+ 'events': [
+ {
+ 'name': 'TestEvent',
+ 'parameters': [
+ {'name': 'p1', 'type': 'number'},
+ {'name': 'p2', 'type': 'integer'},
+ {'name': 'p3', 'type': 'boolean'},
+ {'name': 'p4', 'type': 'string'},
+ {'name': 'p5', 'type': 'any'},
+ {'name': 'p6', 'type': 'object', '$ref': 'TestType'},
+ ]
+ },
+ {
+ 'name': 'TestEventWithNoParams',
+ }
+ ]
+ }
+ ]
+ }
+ expected_types = [
+ {
+ 'type': 'object',
+ 'id': 'TestEventParams',
+ 'description': 'Parameters for the TestEvent event.',
+ 'properties': [
+ {'type': 'number', 'name': 'p1'},
+ {'type': 'integer', 'name': 'p2'},
+ {'type': 'boolean', 'name': 'p3'},
+ {'type': 'string', 'name': 'p4'},
+ {'type': 'any', 'name': 'p5'},
+ {'type': 'object', 'name': 'p6', '$ref': 'TestType'}
+ ]
+ },
+ {
+ 'type': 'object',
+ 'id': 'TestEventWithNoParamsParams',
+ 'description': 'Parameters for the TestEventWithNoParams event.',
+ 'properties': [],
+ }
+ ]
+ client_api_generator.SynthesizeEventTypes(json_api)
+ 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