| 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 logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import sys | 10 import sys |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 class TestListerRunner(test_runner.TestRunner): | 98 class TestListerRunner(test_runner.TestRunner): |
| 99 def RunTest(self, _test): | 99 def RunTest(self, _test): |
| 100 result = TestListResult() | 100 result = TestListResult() |
| 101 self.test_package.Install(self.device) | 101 self.test_package.Install(self.device) |
| 102 result.test_list = self.test_package.GetAllTests(self.device) | 102 result.test_list = self.test_package.GetAllTests(self.device) |
| 103 results = base_test_result.TestRunResults() | 103 results = base_test_result.TestRunResults() |
| 104 results.AddResult(result) | 104 results.AddResult(result) |
| 105 return results, None | 105 return results, None |
| 106 return TestListerRunner(test_options, device, test_package) | 106 return TestListerRunner(test_options, device, test_package) |
| 107 | 107 |
| 108 results, _no_retry = test_dispatcher.RunTests( | 108 results, _ = test_dispatcher.RunTests( |
| 109 ['gtest_list_tests'], TestListerRunnerFactory, devices) | 109 ['gtest_list_tests'], TestListerRunnerFactory, devices) |
| 110 tests = [] | 110 tests = [] |
| 111 for r in results.GetAll(): | 111 for r in results.GetAll(): |
| 112 tests.extend(r.test_list) | 112 tests.extend(r.test_list) |
| 113 return tests | 113 return tests |
| 114 | 114 |
| 115 | 115 |
| 116 def _FilterTestsUsingPrefixes(all_tests, pre=False, manual=False): | 116 def _FilterTestsUsingPrefixes(all_tests, pre=False, manual=False): |
| 117 """Removes tests with disabled prefixes. | 117 """Removes tests with disabled prefixes. |
| 118 | 118 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 if test_options.gtest_filter: | 220 if test_options.gtest_filter: |
| 221 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) | 221 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) |
| 222 | 222 |
| 223 # Coalesce unit tests into a single test per device | 223 # Coalesce unit tests into a single test per device |
| 224 if test_options.suite_name not in gtest_test_instance.BROWSER_TEST_SUITES: | 224 if test_options.suite_name not in gtest_test_instance.BROWSER_TEST_SUITES: |
| 225 num_devices = len(devices) | 225 num_devices = len(devices) |
| 226 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] | 226 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] |
| 227 tests = [t for t in tests if t] | 227 tests = [t for t in tests if t] |
| 228 | 228 |
| 229 return (TestRunnerFactory, tests) | 229 return (TestRunnerFactory, tests) |
| OLD | NEW |