Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: build/android/pylib/browsertests/dispatch.py

Issue 12263024: Android: Add test runner scripts to run content_browsertests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Frank's comments and fixed typo in constants.py Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/android/pylib/browsertests/__init__.py ('k') | build/android/pylib/constants.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 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.
4
5 import logging
6 import os
7
8 from pylib import android_commands
9 from pylib import cmd_helper
10 from pylib import constants
11 from pylib import ports
12 from pylib.base import shard
13 from pylib.gtest import dispatch as gtest_dispatch
14 from pylib.gtest import test_runner
15
16 CONTENT_BROWSERTEST_SUITENAME = 'content_browsertests'
17
18
19 def Dispatch(options):
20 attached_devices = []
21 if options.test_device:
22 attached_devices = [options.test_device]
23 else:
24 attached_devices = android_commands.GetAttachedDevices()
25
26 if not attached_devices:
27 logging.critical('A device must be attached and online.')
28 return 1
29
30 # Reset the test port allocation. It's important to do it before starting
31 # to dispatch any tests.
32 if not ports.ResetTestServerPortAllocation():
33 raise Exception('Failed to reset test server port.')
34
35 test_suite_dir = os.path.join(cmd_helper.OutDirectory.get(),
36 options.build_type)
37 options.test_suite = os.path.join(test_suite_dir,
38 'apks',
39 CONTENT_BROWSERTEST_SUITENAME + '.apk')
40
41 options.test_arguments = '--single_process %s' % options.test_arguments
42
43 # Constructs a new TestRunner with the current options.
44 def RunnerFactory(device):
45 return test_runner.TestRunner(
46 device,
47 options.test_suite,
48 options.test_arguments,
49 options.timeout,
50 options.cleanup_test_files,
51 options.tool,
52 options.build_type,
53 options.webkit,
54 constants.BROWSERTEST_TEST_PACKAGE_NAME,
55 constants.BROWSERTEST_TEST_ACTIVITY_NAME,
56 constants.BROWSERTEST_COMMAND_LINE_FILE)
57
58 # Get tests and split them up based on the number of devices.
59 if options.gtest_filter:
60 all_tests = [t for t in options.gtest_filter.split(':') if t]
61 else:
62 all_tests = gtest_dispatch.GetAllEnabledTests(RunnerFactory,
63 attached_devices)
64
65 # Run tests.
66 test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices,
67 all_tests, options.build_type)
68 test_results.LogFull(
69 test_type='Unit test',
70 test_package=CONTENT_BROWSERTEST_SUITENAME,
71 build_type=options.build_type,
72 flakiness_server=options.flakiness_dashboard_server)
73 test_results.PrintAnnotation()
OLDNEW
« no previous file with comments | « build/android/pylib/browsertests/__init__.py ('k') | build/android/pylib/constants.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698