Index: build/android/pylib/browsertests/test_sharder.py |
diff --git a/build/android/pylib/browsertests/test_sharder.py b/build/android/pylib/browsertests/test_sharder.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a63407fc4e89befefd581248a1a5d3313ec78589 |
--- /dev/null |
+++ b/build/android/pylib/browsertests/test_sharder.py |
@@ -0,0 +1,53 @@ |
+# 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. |
+ |
+from pylib import constants |
+from pylib.base import base_test_sharder |
+from pylib.gtest import test_runner |
+ |
+class TestSharder(base_test_sharder.BaseTestSharder): |
+ """Responsible for sharding the tests on the connected devices.""" |
+ |
+ def __init__(self, attached_devices, test_suite, gtest_filter, |
+ test_arguments, timeout, cleanup_test_files, tool, |
+ build_type, in_webkit_checkout): |
+ super(TestSharder, self).__init__(attached_devices, build_type) |
+ self.test_suite = test_suite |
+ self.gtest_filter = gtest_filter or '' |
+ self.test_arguments = '--single_process %s' % test_arguments |
+ self.timeout = timeout |
+ self.cleanup_test_files = cleanup_test_files |
+ self.tool = tool |
+ self.in_webkit_checkout = in_webkit_checkout |
+ self.all_tests = [] |
+ if not self.gtest_filter: |
+ # TODO(nileshagrawal): Add support to get all the tests. |
+ raise Exception('You have not specified a test filter.') |
+ self.tests = self.all_tests |
+ |
+ def CreateShardedTestRunner(self, device, index): |
+ """Creates a suite-specific test runner. |
+ |
+ Args: |
+ device: Device serial where this shard will run. |
+ index: Index of this device in the pool. |
+ |
+ Returns: |
+ A TestRunner object. |
+ """ |
+ test_filter = self.gtest_filter |
+ return test_runner.TestRunner( |
+ device, |
+ self.test_suite, |
+ self.gtest_filter, |
+ self.test_arguments, |
+ self.timeout, |
+ self.cleanup_test_files, |
+ self.tool, |
+ 0, |
+ self.build_type, |
+ self.in_webkit_checkout, |
+ constants.BROWSERTEST_TEST_PACKAGE_NAME, |
+ constants.BROWSERTEST_TEST_ACTIVITY_NAME, |
+ constants.BROWSERTEST_COMMAND_LINE_FILE) |