| OLD | NEW |
| 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 Loading... |
| 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)) |
| OLD | NEW |