| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Generates test runner factory and tests for GTests.""" | 5 """Generates test runner factory and tests for GTests.""" |
| 6 # pylint: disable=W0212 | 6 # pylint: disable=W0212 |
| 7 | 7 |
| 8 import fnmatch | 8 import fnmatch |
| 9 import glob | 9 import glob |
| 10 import logging | 10 import logging |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 Args: | 206 Args: |
| 207 test_options: A GTestOptions object. | 207 test_options: A GTestOptions object. |
| 208 test_package: A TestPackageApk object. | 208 test_package: A TestPackageApk object. |
| 209 devices: A list of attached devices. | 209 devices: A list of attached devices. |
| 210 | 210 |
| 211 Returns: | 211 Returns: |
| 212 A list of all the tests in the test suite. | 212 A list of all the tests in the test suite. |
| 213 """ | 213 """ |
| 214 def TestListerRunnerFactory(device, _shard_index): | 214 def TestListerRunnerFactory(device, _shard_index): |
| 215 class TestListerRunner(test_runner.TestRunner): | 215 class TestListerRunner(test_runner.TestRunner): |
| 216 #override |
| 217 def PushDataDeps(self): |
| 218 pass |
| 219 |
| 220 #override |
| 216 def RunTest(self, _test): | 221 def RunTest(self, _test): |
| 217 result = base_test_result.BaseTestResult( | 222 result = base_test_result.BaseTestResult( |
| 218 'gtest_list_tests', base_test_result.ResultType.PASS) | 223 'gtest_list_tests', base_test_result.ResultType.PASS) |
| 219 self.test_package.Install(self.device) | 224 self.test_package.Install(self.device) |
| 220 result.test_list = self.test_package.GetAllTests(self.device) | 225 result.test_list = self.test_package.GetAllTests(self.device) |
| 221 results = base_test_result.TestRunResults() | 226 results = base_test_result.TestRunResults() |
| 222 results.AddResult(result) | 227 results.AddResult(result) |
| 223 return results, None | 228 return results, None |
| 224 return TestListerRunner(test_options, device, test_package) | 229 return TestListerRunner(test_options, device, test_package) |
| 225 | 230 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 if test_options.gtest_filter: | 329 if test_options.gtest_filter: |
| 325 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) | 330 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) |
| 326 | 331 |
| 327 # Coalesce unit tests into a single test per device | 332 # Coalesce unit tests into a single test per device |
| 328 if test_options.suite_name != 'content_browsertests': | 333 if test_options.suite_name != 'content_browsertests': |
| 329 num_devices = len(devices) | 334 num_devices = len(devices) |
| 330 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] | 335 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] |
| 331 tests = [t for t in tests if t] | 336 tests = [t for t in tests if t] |
| 332 | 337 |
| 333 return (TestRunnerFactory, tests) | 338 return (TestRunnerFactory, tests) |
| OLD | NEW |