Roll src/third_party/WebKit a3b4a2e:7441784 (svn 202551:202552)
[chromium-blink-merge.git] / build / android / pylib / uiautomator / setup.py
blob1b8746b41f61c1a5b3c176511fba583fafe14834
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """Generates test runner factory and tests for uiautomator tests."""
7 import logging
9 from pylib.uiautomator import test_package
10 from pylib.uiautomator import test_runner
13 def Setup(test_options, devices):
14 """Runs uiautomator tests on connected device(s).
16 Args:
17 test_options: A UIAutomatorOptions object.
18 devices: The list of that tests will run on.
20 Returns:
21 A tuple of (TestRunnerFactory, tests).
22 """
23 test_pkg = test_package.TestPackage(test_options.uiautomator_jar,
24 test_options.uiautomator_info_jar)
25 tests = test_pkg.GetAllMatchingTests(test_options.annotations,
26 test_options.exclude_annotations,
27 test_options.test_filter,
28 devices)
30 if not tests:
31 logging.error('No uiautomator tests to run with current args.')
33 def TestRunnerFactory(device, shard_index):
34 return test_runner.TestRunner(
35 test_options, device, shard_index, test_pkg)
37 return (TestRunnerFactory, tests)