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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/browsertests/__init__.py ('k') | build/android/pylib/constants.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/browsertests/dispatch.py
diff --git a/build/android/pylib/browsertests/dispatch.py b/build/android/pylib/browsertests/dispatch.py
new file mode 100644
index 0000000000000000000000000000000000000000..95a7ffd82ade4d12214f9debd7bae948209718de
--- /dev/null
+++ b/build/android/pylib/browsertests/dispatch.py
@@ -0,0 +1,73 @@
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import logging
+import os
+
+from pylib import android_commands
+from pylib import cmd_helper
+from pylib import constants
+from pylib import ports
+from pylib.base import shard
+from pylib.gtest import dispatch as gtest_dispatch
+from pylib.gtest import test_runner
+
+CONTENT_BROWSERTEST_SUITENAME = 'content_browsertests'
+
+
+def Dispatch(options):
+ 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 1
+
+ # Reset the test port allocation. It's important to do it before starting
+ # to dispatch any tests.
+ if not ports.ResetTestServerPortAllocation():
+ raise Exception('Failed to reset test server port.')
+
+ test_suite_dir = os.path.join(cmd_helper.OutDirectory.get(),
+ options.build_type)
+ options.test_suite = os.path.join(test_suite_dir,
+ 'apks',
+ CONTENT_BROWSERTEST_SUITENAME + '.apk')
+
+ options.test_arguments = '--single_process %s' % options.test_arguments
+
+ # Constructs a new TestRunner with the current options.
+ def RunnerFactory(device):
+ return test_runner.TestRunner(
+ device,
+ options.test_suite,
+ options.test_arguments,
+ options.timeout,
+ options.cleanup_test_files,
+ options.tool,
+ options.build_type,
+ options.webkit,
+ constants.BROWSERTEST_TEST_PACKAGE_NAME,
+ constants.BROWSERTEST_TEST_ACTIVITY_NAME,
+ constants.BROWSERTEST_COMMAND_LINE_FILE)
+
+ # Get tests and split them up based on the number of devices.
+ if options.gtest_filter:
+ all_tests = [t for t in options.gtest_filter.split(':') if t]
+ else:
+ all_tests = gtest_dispatch.GetAllEnabledTests(RunnerFactory,
+ attached_devices)
+
+ # Run tests.
+ test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices,
+ all_tests, options.build_type)
+ test_results.LogFull(
+ test_type='Unit test',
+ test_package=CONTENT_BROWSERTEST_SUITENAME,
+ build_type=options.build_type,
+ flakiness_server=options.flakiness_dashboard_server)
+ test_results.PrintAnnotation()
« 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