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

Side by Side Diff: testing/scripts/headless_python_unittests.py

Issue 2473073003: [headless] Refactor headless devtools client API. (Closed)
Patch Set: Address nits Created 4 years, 1 month 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/test/headless_browser_test.cc ('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 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 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 json 6 import json
7 import os 7 import os
8 import sys 8 import sys
9 9
10 10
11 import common 11 import common
12 12
13 13
14 def main_run(args): 14 def main_run(args):
15 typ_path = os.path.abspath(os.path.join( 15 typ_path = os.path.abspath(os.path.join(
16 os.path.dirname(__file__), os.path.pardir, os.path.pardir, 16 os.path.dirname(__file__), os.path.pardir, os.path.pardir,
17 'third_party', 'typ')) 17 'third_party', 'typ'))
18 _AddToPathIfNeeded(typ_path) 18 _AddToPathIfNeeded(typ_path)
19 import typ 19 import typ
20 20
21 top_level_dir = os.path.join(common.SRC_DIR, 'headless', 'lib', 'browser') 21 top_level_dir = os.path.join(
22 common.SRC_DIR, 'headless', 'lib', 'browser', 'devtools_api')
22 with common.temporary_file() as tempfile_path: 23 with common.temporary_file() as tempfile_path:
23 rc = typ.main( 24 rc = typ.main(
24 argv=[], 25 argv=[],
25 top_level_dir=top_level_dir, 26 top_level_dir=top_level_dir,
26 write_full_results_to=tempfile_path, 27 write_full_results_to=tempfile_path,
27 coverage_source=[top_level_dir]) 28 coverage_source=[top_level_dir])
28 29
29 with open(tempfile_path) as f: 30 with open(tempfile_path) as f:
30 results = json.load(f) 31 results = json.load(f)
31 32
(...skipping 17 matching lines...) Expand all
49 if path not in sys.path: 50 if path not in sys.path:
50 sys.path.insert(0, path) 51 sys.path.insert(0, path)
51 52
52 53
53 if __name__ == '__main__': 54 if __name__ == '__main__':
54 funcs = { 55 funcs = {
55 'run': main_run, 56 'run': main_run,
56 'compile_targets': main_compile_targets, 57 'compile_targets': main_compile_targets,
57 } 58 }
58 sys.exit(common.run_script(sys.argv[1:], funcs)) 59 sys.exit(common.run_script(sys.argv[1:], funcs))
OLDNEW
« no previous file with comments | « headless/test/headless_browser_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698