Chromium Code Reviews| Index: build/android/pylib/browsertests/dispatch.py |
| diff --git a/build/android/pylib/browsertests/dispatch.py b/build/android/pylib/browsertests/dispatch.py |
| index ce1bc5acc4be1dbf732a5d86136ae40be2e3051d..709ffd5642d56e626a94529f83532ac427deabba 100644 |
| --- a/build/android/pylib/browsertests/dispatch.py |
| +++ b/build/android/pylib/browsertests/dispatch.py |
| @@ -2,6 +2,8 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| +"""Dispatches Content Browser tests.""" |
|
frankf
2013/06/27 23:13:35
-> content_browsertests, also in other places.
gkanwar
2013/06/28 22:09:45
Done.
|
| + |
| import logging |
| import os |
| import sys |
| @@ -17,10 +19,12 @@ from pylib.utils import report_results |
| sys.path.insert(0, |
| os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib')) |
| - |
| from common import unittest_util |
| + |
| def Dispatch(options): |
| + """Dispatches all Content Browser tests.""" |
| + |
| attached_devices = [] |
| if options.test_device: |
| attached_devices = [options.test_device] |
| @@ -61,9 +65,9 @@ def Dispatch(options): |
| # Get tests and split them up based on the number of devices. |
| all_enabled = gtest_dispatch.GetAllEnabledTests(RunnerFactory, |
| attached_devices) |
| - if options.gtest_filter: |
| + if options.test_filter: |
| all_tests = unittest_util.FilterTestNames(all_enabled, |
| - options.gtest_filter) |
| + options.test_filter) |
| else: |
| all_tests = _FilterTests(all_enabled) |
| @@ -84,17 +88,22 @@ def Dispatch(options): |
| flakiness_server=options.flakiness_dashboard_server) |
| report_results.PrintAnnotation(test_results) |
| + return len(test_results.GetNotPass()) |
| + |
| + |
| def _FilterTests(all_enabled_tests): |
| """Filters out tests and fixtures starting with PRE_ and MANUAL_.""" |
| return [t for t in all_enabled_tests if _ShouldRunOnBot(t)] |
| + |
| def _ShouldRunOnBot(test): |
| fixture, case = test.split('.', 1) |
| - if _StartsWith(fixture, case, "PRE_"): |
| + if _StartsWith(fixture, case, 'PRE_'): |
| return False |
| - if _StartsWith(fixture, case, "MANUAL_"): |
| + if _StartsWith(fixture, case, 'MANUAL_'): |
| return False |
| return True |
| + |
| def _StartsWith(a, b, prefix): |
| return a.startswith(prefix) or b.startswith(prefix) |