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

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

Issue 1062573004: [Extension API Extern Generation] Fix a few bugs in extern generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dan's Created 5 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 unified diff | Download patch
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_externs_generator import JsExternsGenerator 8 from js_externs_generator import JsExternsGenerator
9 from datetime import datetime 9 from datetime import datetime
10 import model 10 import model
(...skipping 25 matching lines...) Expand all
36 boolean b; 36 boolean b;
37 Greek letter; 37 Greek letter;
38 Greek? optionalLetter; 38 Greek? optionalLetter;
39 long[] arr; 39 long[] arr;
40 Bar[]? optionalObjArr; 40 Bar[]? optionalObjArr;
41 Greek[] enumArr; 41 Greek[] enumArr;
42 any[] anythingGoes; 42 any[] anythingGoes;
43 Bar obj; 43 Bar obj;
44 long? maybe; 44 long? maybe;
45 (DOMString or Greek or long[]) choice; 45 (DOMString or Greek or long[]) choice;
46 object plainObj;
46 }; 47 };
47 48
48 callback VoidCallback = void(); 49 callback VoidCallback = void();
49 50
50 callback BazGreekCallback = void(Baz baz, Greek greek); 51 callback BazGreekCallback = void(Baz baz, Greek greek);
51 52
52 interface Functions { 53 interface Functions {
53 // Does something exciting! And what's more, this is a multiline function 54 // Does something exciting! And what's more, this is a multiline function
54 // comment! It goes onto multiple lines! 55 // comment! It goes onto multiple lines!
55 // |baz| : The baz to use. 56 // |baz| : The baz to use.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 * num: number, 108 * num: number,
108 * b: boolean, 109 * b: boolean,
109 * letter: !chrome.fakeApi.Greek, 110 * letter: !chrome.fakeApi.Greek,
110 * optionalLetter: (!chrome.fakeApi.Greek|undefined), 111 * optionalLetter: (!chrome.fakeApi.Greek|undefined),
111 * arr: !Array<number>, 112 * arr: !Array<number>,
112 * optionalObjArr: (!Array<Bar>|undefined), 113 * optionalObjArr: (!Array<Bar>|undefined),
113 * enumArr: !Array<!chrome.fakeApi.Greek>, 114 * enumArr: !Array<!chrome.fakeApi.Greek>,
114 * anythingGoes: !Array<*>, 115 * anythingGoes: !Array<*>,
115 * obj: Bar, 116 * obj: Bar,
116 * maybe: (number|undefined), 117 * maybe: (number|undefined),
117 * choice: (string|!chrome.fakeApi.Greek|!Array<number>) 118 * choice: (string|!chrome.fakeApi.Greek|!Array<number>),
119 * plainObj: Object
118 * }} 120 * }}
119 * @see https://developer.chrome.com/extensions/fakeApi#type-Baz 121 * @see https://developer.chrome.com/extensions/fakeApi#type-Baz
120 */ 122 */
121 var Baz; 123 var Baz;
122 124
123 /** 125 /**
124 * Does something exciting! And what's more, this is a multiline function 126 * Does something exciting! And what's more, this is a multiline function
125 * comment! It goes onto multiple lines! 127 * comment! It goes onto multiple lines!
126 * @param {Baz} baz The baz to use. 128 * @param {Baz} baz The baz to use.
127 * @param {function():void} callback 129 * @param {function():void} callback
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 JsExternsGenerator().Generate(namespace).Render()) 269 JsExternsGenerator().Generate(namespace).Render())
268 270
269 def testJsonWithInlineObjects(self): 271 def testJsonWithInlineObjects(self):
270 namespace = self._GetNamespace(fake_json, 'fake_api.json', False) 272 namespace = self._GetNamespace(fake_json, 'fake_api.json', False)
271 self.assertMultiLineEqual(json_expected, 273 self.assertMultiLineEqual(json_expected,
272 JsExternsGenerator().Generate(namespace).Render()) 274 JsExternsGenerator().Generate(namespace).Render())
273 275
274 276
275 if __name__ == '__main__': 277 if __name__ == '__main__':
276 unittest.main() 278 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698