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

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

Issue 1605083002: Elim 'new ChromeEvent' from interface generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_563744_line_wrap
Patch Set: Rebase Created 4 years, 11 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
« no previous file with comments | « tools/json_schema_compiler/js_interface_generator.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 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 json_parse 7 import json_parse
8 from js_interface_generator import JsInterfaceGenerator 8 from js_interface_generator import JsInterfaceGenerator
9 from datetime import datetime 9 from datetime import datetime
10 import model 10 import model
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 doSomething: assertNotReached, 97 doSomething: assertNotReached,
98 98
99 /** 99 /**
100 * @param {function(!chrome.fakeApi.Baz, !chrome.fakeApi.Greek):void=} 100 * @param {function(!chrome.fakeApi.Baz, !chrome.fakeApi.Greek):void=}
101 * callback The callback which will most assuredly in all cases be called; 101 * callback The callback which will most assuredly in all cases be called;
102 * that is, of course, iff such a callback was provided and is not at all 102 * that is, of course, iff such a callback was provided and is not at all
103 * null. 103 * null.
104 * @see https://developer.chrome.com/extensions/fakeApi#method-bazGreek 104 * @see https://developer.chrome.com/extensions/fakeApi#method-bazGreek
105 */ 105 */
106 bazGreek: assertNotReached, 106 bazGreek: assertNotReached,
107 };
107 108
108 /** 109 /**
109 * Fired when we realize it's a trap! 110 * Fired when we realize it's a trap!
110 * @type {!ChromeEvent} 111 * @type {!ChromeEvent}
111 * @see https://developer.chrome.com/extensions/fakeApi#event-onTrapDetected 112 * @see https://developer.chrome.com/extensions/fakeApi#event-onTrapDetected
112 */ 113 */
113 onTrapDetected: new ChromeEvent(), 114 FakeApi.prototype.onTrapDetected;""" % (datetime.now().year, sys.argv[0]))
114 };""" % (datetime.now().year, sys.argv[0]))
115 115
116 class JsExternGeneratorTest(unittest.TestCase): 116 class JsExternGeneratorTest(unittest.TestCase):
117 def _GetNamespace(self, fake_content, filename): 117 def _GetNamespace(self, fake_content, filename):
118 """Returns a namespace object for the given content""" 118 """Returns a namespace object for the given content"""
119 api_def = idl_schema.Process(fake_content, filename) 119 api_def = idl_schema.Process(fake_content, filename)
120 m = model.Model() 120 m = model.Model()
121 return m.AddNamespace(api_def[0], filename) 121 return m.AddNamespace(api_def[0], filename)
122 122
123 def setUp(self): 123 def setUp(self):
124 self.maxDiff = None # Lets us see the full diff when inequal. 124 self.maxDiff = None # Lets us see the full diff when inequal.
125 125
126 def testBasic(self): 126 def testBasic(self):
127 namespace = self._GetNamespace(fake_idl, 'fake_api.idl') 127 namespace = self._GetNamespace(fake_idl, 'fake_api.idl')
128 self.assertMultiLineEqual( 128 self.assertMultiLineEqual(
129 expected_output, 129 expected_output,
130 JsInterfaceGenerator().Generate(namespace).Render()) 130 JsInterfaceGenerator().Generate(namespace).Render())
131 131
132 132
133 if __name__ == '__main__': 133 if __name__ == '__main__':
134 unittest.main() 134 unittest.main()
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/js_interface_generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698