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

Side by Side Diff: headless/lib/browser/devtools_api/client_api_generator_unittest.py

Issue 2862843002: headless: Avoid copies for string parameters in DevTools bindings (Closed)
Patch Set: Created 3 years, 7 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 | « headless/lib/browser/devtools_api/client_api_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 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
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
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)
OLDNEW
« no previous file with comments | « headless/lib/browser/devtools_api/client_api_generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698