| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright 2016 The Chromium Authors. All rights reserved. | 3 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 import client_api_generator | 7 import client_api_generator |
| 8 import shutil | 8 import shutil |
| 9 import sys | 9 import sys |
| 10 import tempfile | 10 import tempfile |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 'type': 'string', | 140 'type': 'string', |
| 141 }, | 141 }, |
| 142 ] | 142 ] |
| 143 }, | 143 }, |
| 144 ] | 144 ] |
| 145 } | 145 } |
| 146 client_api_generator.CreateTypeDefinitions(json_api) | 146 client_api_generator.CreateTypeDefinitions(json_api) |
| 147 type = json_api['domains'][0]['types'][0] | 147 type = json_api['domains'][0]['types'][0] |
| 148 resolved = client_api_generator.ResolveType(type) | 148 resolved = client_api_generator.ResolveType(type) |
| 149 self.assertEqual('std::string', resolved['raw_type']) | 149 self.assertEqual('std::string', resolved['raw_type']) |
| 150 self.assertEqual('const std::string&', resolved['pass_type']) |
| 150 | 151 |
| 151 def test_ObjectType(self): | 152 def test_ObjectType(self): |
| 152 json_api = { | 153 json_api = { |
| 153 'domains': [ | 154 'domains': [ |
| 154 { | 155 { |
| 155 'domain': 'domain', | 156 'domain': 'domain', |
| 156 'types': [ | 157 'types': [ |
| 157 { | 158 { |
| 158 'id': 'TestType', | 159 'id': 'TestType', |
| 159 'type': 'object', | 160 'type': 'object', |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 jinja_env, dirname, json_api, | 551 jinja_env, dirname, json_api, |
| 551 'domain', ['cc', 'h'], lambda domain_name: domain_name) | 552 'domain', ['cc', 'h'], lambda domain_name: domain_name) |
| 552 # This is just a smoke test; we don't actually verify the generated output | 553 # This is just a smoke test; we don't actually verify the generated output |
| 553 # here. | 554 # here. |
| 554 finally: | 555 finally: |
| 555 shutil.rmtree(dirname) | 556 shutil.rmtree(dirname) |
| 556 | 557 |
| 557 | 558 |
| 558 if __name__ == '__main__': | 559 if __name__ == '__main__': |
| 559 unittest.main(verbosity=2, exit=False, argv=sys.argv) | 560 unittest.main(verbosity=2, exit=False, argv=sys.argv) |
| OLD | NEW |