| Index: build/android/pylib/browsertests/dispatch.py
|
| diff --git a/build/android/pylib/browsertests/dispatch.py b/build/android/pylib/browsertests/dispatch.py
|
| index 1c8cfb4e8c7291d717a3c73094ccc04f09fdbff3..3b74a5175e7fbacdcc7aa637d0c10e9a28bde482 100644
|
| --- a/build/android/pylib/browsertests/dispatch.py
|
| +++ b/build/android/pylib/browsertests/dispatch.py
|
| @@ -2,7 +2,7 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| -"""Dispatches content_browsertests."""
|
| +"""Runs content_browsertests."""
|
|
|
| import logging
|
| import os
|
| @@ -11,6 +11,7 @@ import sys
|
| from pylib import android_commands
|
| from pylib import cmd_helper
|
| from pylib import constants
|
| +from pylib import dispatch
|
| from pylib import ports
|
| from pylib.base import base_test_result
|
| from pylib.base import shard
|
| @@ -23,8 +24,8 @@ sys.path.insert(0,
|
| from common import unittest_util
|
|
|
|
|
| -def Dispatch(options):
|
| - """Dispatches all content_browsertests.
|
| +def RunContentBrowserTests(options):
|
| + """Runs all content_browsertests.
|
|
|
| Args:
|
| options: optparse.Options object containing command-line options
|
| @@ -34,16 +35,6 @@ def Dispatch(options):
|
| Exception: Failed to reset the test server port.
|
| """
|
|
|
| - attached_devices = []
|
| - if options.test_device:
|
| - attached_devices = [options.test_device]
|
| - else:
|
| - attached_devices = android_commands.GetAttachedDevices()
|
| -
|
| - if not attached_devices:
|
| - logging.critical('A device must be attached and online.')
|
| - return (base_test_result.TestRunResults(), constants.ERROR_EXIT_CODE)
|
| -
|
| # Reset the test port allocation. It's important to do it before starting
|
| # to dispatch any tests.
|
| if not ports.ResetTestServerPortAllocation():
|
| @@ -56,7 +47,7 @@ def Dispatch(options):
|
| constants.BROWSERTEST_SUITE_NAME + '.apk')
|
|
|
| # Constructs a new TestRunner with the current options.
|
| - def RunnerFactory(device, shard_index):
|
| + def TestRunnerFactory(device, shard_index):
|
| return test_runner.TestRunner(
|
| device,
|
| options.test_suite,
|
| @@ -71,8 +62,11 @@ def Dispatch(options):
|
| constants.BROWSERTEST_TEST_ACTIVITY_NAME,
|
| constants.BROWSERTEST_COMMAND_LINE_FILE)
|
|
|
| + # TODO(gkanwar): This breaks the abstraction of having dispatch.Dispatch deal
|
| + # entirely with the devices. Can we do this another way?
|
| + attached_devices = android_commands.GetAttachedDevices()
|
| # Get tests and split them up based on the number of devices.
|
| - all_enabled = gtest_dispatch.GetAllEnabledTests(RunnerFactory,
|
| + all_enabled = gtest_dispatch.GetAllEnabledTests(TestRunnerFactory,
|
| attached_devices)
|
| if options.test_filter:
|
| all_tests = unittest_util.FilterTestNames(all_enabled,
|
| @@ -84,18 +78,17 @@ def Dispatch(options):
|
| # TODO(nileshagrawal): remove this abnormally long setup timeout once fewer
|
| # files are pushed to the devices for content_browsertests: crbug.com/138275
|
| setup_timeout = 20 * 60 # 20 minutes
|
| - test_results, exit_code = shard.ShardAndRunTests(
|
| - RunnerFactory, attached_devices, all_tests, options.build_type,
|
| - setup_timeout=setup_timeout, test_timeout=None,
|
| - num_retries=options.num_retries)
|
| + results, exit_code = dispatch.Dispatch(options, all_tests, TestRunnerFactory,
|
| + distribution='shard',
|
| + setup_timeout=setup_timeout)
|
| report_results.LogFull(
|
| - results=test_results,
|
| + results=results,
|
| test_type='Unit test',
|
| test_package=constants.BROWSERTEST_SUITE_NAME,
|
| build_type=options.build_type,
|
| flakiness_server=options.flakiness_dashboard_server)
|
|
|
| - return (test_results, exit_code)
|
| + return (results, exit_code)
|
|
|
|
|
| def _FilterTests(all_enabled_tests):
|
|
|