OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import argparse | 5 import argparse |
6 import json | 6 import json |
7 import logging | 7 import logging |
8 import re | 8 import re |
9 import time | 9 import time |
10 import unittest | 10 import unittest |
(...skipping 13 matching lines...) Expand all Loading... |
24 options = browser_options.BrowserFinderOptions() | 24 options = browser_options.BrowserFinderOptions() |
25 options.browser_type = 'any' | 25 options.browser_type = 'any' |
26 parser = options.CreateParser(test_class.__doc__) | 26 parser = options.CreateParser(test_class.__doc__) |
27 test_class.AddCommandlineArgs(parser) | 27 test_class.AddCommandlineArgs(parser) |
28 # Set the default chrome root variable. This is required for the | 28 # Set the default chrome root variable. This is required for the |
29 # Android browser finder to function properly. | 29 # Android browser finder to function properly. |
30 parser.set_defaults(chrome_root=project_config.default_chrome_root) | 30 parser.set_defaults(chrome_root=project_config.default_chrome_root) |
31 finder_options, positional_args = parser.parse_args(args) | 31 finder_options, positional_args = parser.parse_args(args) |
32 finder_options.positional_args = positional_args | 32 finder_options.positional_args = positional_args |
33 options_for_unittests.Push(finder_options) | 33 options_for_unittests.Push(finder_options) |
| 34 # Use this to signal serially_executed_browser_test_case.LoadAllTestsInModule |
| 35 # not to load tests in cases it's not invoked by browser_test_runner |
| 36 # framework. |
| 37 finder_options.browser_test_runner_running = True |
34 return finder_options | 38 return finder_options |
35 | 39 |
36 | 40 |
37 def _ValidateDistinctNames(browser_test_classes): | 41 def _ValidateDistinctNames(browser_test_classes): |
38 names_to_test_classes = {} | 42 names_to_test_classes = {} |
39 for cl in browser_test_classes: | 43 for cl in browser_test_classes: |
40 name = cl.Name() | 44 name = cl.Name() |
41 if name in names_to_test_classes: | 45 if name in names_to_test_classes: |
42 raise Exception('Test name %s is duplicated between %s and %s' % ( | 46 raise Exception('Test name %s is duplicated between %s and %s' % ( |
43 name, repr(cl), repr(names_to_test_classes[name]))) | 47 name, repr(cl), repr(names_to_test_classes[name]))) |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 # as failure name in this case since shortName() is not available. | 304 # as failure name in this case since shortName() is not available. |
301 failures.append(fail.id()) | 305 failures.append(fail.id()) |
302 failures = sorted(list(failures)) | 306 failures = sorted(list(failures)) |
303 for failure_id in failures: | 307 for failure_id in failures: |
304 json_results['failures'].append(failure_id) | 308 json_results['failures'].append(failure_id) |
305 for passed_test_case in results.successes: | 309 for passed_test_case in results.successes: |
306 json_results['successes'].append(passed_test_case.shortName()) | 310 json_results['successes'].append(passed_test_case.shortName()) |
307 json_results['times'].update(results.times) | 311 json_results['times'].update(results.times) |
308 json.dump(json_results, f) | 312 json.dump(json_results, f) |
309 return len(results.failures + results.errors) | 313 return len(results.failures + results.errors) |
OLD | NEW |