OLD | NEW |
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 # The output we expect from our fake idl file. | 74 # The output we expect from our fake idl file. |
75 expected_output = ("""// Copyright %s The Chromium Authors. All rights reserved. | 75 expected_output = ("""// Copyright %s The Chromium Authors. All rights reserved. |
76 // Use of this source code is governed by a BSD-style license that can be | 76 // Use of this source code is governed by a BSD-style license that can be |
77 // found in the LICENSE file. | 77 // found in the LICENSE file. |
78 | 78 |
79 // This file was generated by: | 79 // This file was generated by: |
80 // %s. | 80 // %s. |
81 // NOTE: The format of types has changed. 'FooType' is now | 81 // NOTE: The format of types has changed. 'FooType' is now |
82 // 'chrome.fakeApi.FooType'. | 82 // 'chrome.fakeApi.FooType'. |
83 // Please run the closure compiler before committing changes. | 83 // Please run the closure compiler before committing changes. |
84 // See https://code.google.com/p/chromium/wiki/ClosureCompilation. | 84 // See https://chromium.googlesource.com/chromium/src/+/master/docs/closure_comp
ilation.md |
85 | 85 |
86 /** @fileoverview Externs generated from namespace: fakeApi */ | 86 /** @fileoverview Externs generated from namespace: fakeApi */ |
87 | 87 |
88 /** | 88 /** |
89 * @const | 89 * @const |
90 */ | 90 */ |
91 chrome.fakeApi = {}; | 91 chrome.fakeApi = {}; |
92 | 92 |
93 /** | 93 /** |
94 * @enum {string} | 94 * @enum {string} |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 233 |
234 json_expected = ("""// Copyright %s The Chromium Authors. All rights reserved. | 234 json_expected = ("""// Copyright %s The Chromium Authors. All rights reserved. |
235 // Use of this source code is governed by a BSD-style license that can be | 235 // Use of this source code is governed by a BSD-style license that can be |
236 // found in the LICENSE file. | 236 // found in the LICENSE file. |
237 | 237 |
238 // This file was generated by: | 238 // This file was generated by: |
239 // %s. | 239 // %s. |
240 // NOTE: The format of types has changed. 'FooType' is now | 240 // NOTE: The format of types has changed. 'FooType' is now |
241 // 'chrome.fakeJson.FooType'. | 241 // 'chrome.fakeJson.FooType'. |
242 // Please run the closure compiler before committing changes. | 242 // Please run the closure compiler before committing changes. |
243 // See https://code.google.com/p/chromium/wiki/ClosureCompilation. | 243 // See https://chromium.googlesource.com/chromium/src/+/master/docs/closure_comp
ilation.md |
244 | 244 |
245 /** @fileoverview Externs generated from namespace: fakeJson */ | 245 /** @fileoverview Externs generated from namespace: fakeJson */ |
246 | 246 |
247 /** | 247 /** |
248 * @const | 248 * @const |
249 */ | 249 */ |
250 chrome.fakeJson = {}; | 250 chrome.fakeJson = {}; |
251 | 251 |
252 /** | 252 /** |
253 * @enum {string} | 253 * @enum {string} |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 JsExternsGenerator().Generate(namespace).Render()) | 299 JsExternsGenerator().Generate(namespace).Render()) |
300 | 300 |
301 def testJsonWithInlineObjects(self): | 301 def testJsonWithInlineObjects(self): |
302 namespace = self._GetNamespace(fake_json, 'fake_api.json', False) | 302 namespace = self._GetNamespace(fake_json, 'fake_api.json', False) |
303 self.assertMultiLineEqual(json_expected, | 303 self.assertMultiLineEqual(json_expected, |
304 JsExternsGenerator().Generate(namespace).Render()) | 304 JsExternsGenerator().Generate(namespace).Render()) |
305 | 305 |
306 | 306 |
307 if __name__ == '__main__': | 307 if __name__ == '__main__': |
308 unittest.main() | 308 unittest.main() |
OLD | NEW |