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

Side by Side Diff: build/android/pylib/gtest/test_runner.py

Issue 12263024: Android: Add test runner scripts to run content_browsertests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Actually adding dispatch.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
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 import glob 5 import glob
6 import logging 6 import logging
7 import os 7 import os
8 import sys 8 import sys
9 9
10 from pylib import android_commands 10 from pylib import android_commands
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 'third_party/hyphen/hyph_en_US.dic', 120 'third_party/hyphen/hyph_en_US.dic',
121 ] 121 ]
122 elif test_suite_basename == 'media_unittests': 122 elif test_suite_basename == 'media_unittests':
123 return [ 123 return [
124 'media/test/data', 124 'media/test/data',
125 ] 125 ]
126 elif test_suite_basename == 'cc_perftests': 126 elif test_suite_basename == 'cc_perftests':
127 return [ 127 return [
128 'cc/test/data', 128 'cc/test/data',
129 ] 129 ]
130 elif test_suite_basename == 'content_browsertests':
131 return [
132 'content/test/data',
133 ]
130 return [] 134 return []
131 135
132 136
133 class TestRunner(BaseTestRunner): 137 class TestRunner(BaseTestRunner):
134 """Single test suite attached to a single device. 138 """Single test suite attached to a single device.
135 139
136 Args: 140 Args:
137 device: Device to run the tests. 141 device: Device to run the tests.
138 test_suite: A specific test suite to run, empty to run all. 142 test_suite: A specific test suite to run, empty to run all.
139 gtest_filter: A gtest_filter flag. 143 gtest_filter: A gtest_filter flag.
140 test_arguments: Additional arguments to pass to the test binary. 144 test_arguments: Additional arguments to pass to the test binary.
141 timeout: Timeout for each test. 145 timeout: Timeout for each test.
142 cleanup_test_files: Whether or not to cleanup test files on device. 146 cleanup_test_files: Whether or not to cleanup test files on device.
143 tool: Name of the Valgrind tool. 147 tool: Name of the Valgrind tool.
144 shard_index: index number of the shard on which the test suite will run. 148 shard_index: index number of the shard on which the test suite will run.
145 build_type: 'Release' or 'Debug'. 149 build_type: 'Release' or 'Debug'.
146 in_webkit_checkout: Whether the suite is being run from a WebKit checkout. 150 in_webkit_checkout: Whether the suite is being run from a WebKit checkout.
151 test_apk_package_name: Apk package name for tests running in APKs.
152 test_activity_name: Test activity to invoke for APK tests.
153 command_line_file: Filename to use to pass arguments to tests.
147 """ 154 """
148 155
149 def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout, 156 def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout,
150 cleanup_test_files, tool_name, shard_index, build_type, 157 cleanup_test_files, tool_name, shard_index, build_type,
151 in_webkit_checkout): 158 in_webkit_checkout, test_apk_package_name, test_activity_name,
159 command_line_file):
152 BaseTestRunner.__init__(self, device, tool_name, shard_index, build_type) 160 BaseTestRunner.__init__(self, device, tool_name, shard_index, build_type)
153 self._running_on_emulator = self.device.startswith('emulator') 161 self._running_on_emulator = self.device.startswith('emulator')
154 self._gtest_filter = gtest_filter 162 self._gtest_filter = gtest_filter
155 self._test_arguments = test_arguments 163 self._test_arguments = test_arguments
156 self.test_results = TestResults() 164 self.test_results = TestResults()
157 self.in_webkit_checkout = in_webkit_checkout 165 self.in_webkit_checkout = in_webkit_checkout
158 166
159 logging.warning('Test suite: ' + test_suite) 167 logging.warning('Test suite: ' + test_suite)
160 if os.path.splitext(test_suite)[1] == '.apk': 168 if os.path.splitext(test_suite)[1] == '.apk':
161 self.test_package = TestPackageApk( 169 self.test_package = TestPackageApk(
162 self.adb, 170 self.adb,
163 device, 171 device,
164 test_suite, 172 test_suite,
165 timeout, 173 timeout,
166 cleanup_test_files, 174 cleanup_test_files,
167 self.tool) 175 self.tool,
176 test_apk_package_name,
177 test_activity_name,
178 command_line_file)
168 else: 179 else:
169 # Put a copy into the android out/target directory, to allow stack trace 180 # Put a copy into the android out/target directory, to allow stack trace
170 # generation. 181 # generation.
171 symbols_dir = os.path.join(constants.CHROME_DIR, 'out', build_type, 182 symbols_dir = os.path.join(constants.CHROME_DIR, 'out', build_type,
172 'lib.target') 183 'lib.target')
173 self.test_package = TestPackageExecutable( 184 self.test_package = TestPackageExecutable(
174 self.adb, 185 self.adb,
175 device, 186 device,
176 test_suite, timeout, 187 test_suite, timeout,
177 cleanup_test_files, 188 cleanup_test_files,
178 self.tool, 189 self.tool,
179 symbols_dir) 190 symbols_dir)
180 191
181 def _TestSuiteRequiresMockTestServer(self): 192 def _TestSuiteRequiresMockTestServer(self):
182 """Returns True if the test suite requires mock test server.""" 193 """Returns True if the test suite requires mock test server."""
183 tests_require_net_test_server = ['unit_tests', 'net_unittests', 194 tests_require_net_test_server = ['unit_tests', 'net_unittests',
184 'content_unittests'] 195 'content_unittests',
196 'content_browsertests']
185 return (self.test_package.test_suite_basename in 197 return (self.test_package.test_suite_basename in
186 tests_require_net_test_server) 198 tests_require_net_test_server)
187 199
188 def GetDisabledTests(self): 200 def GetDisabledTests(self):
189 """Returns a list of disabled tests. 201 """Returns a list of disabled tests.
190 202
191 Returns: 203 Returns:
192 A list of disabled tests obtained from 'filter' subdirectory. 204 A list of disabled tests obtained from 'filter' subdirectory.
193 """ 205 """
194 gtest_filter_base_path = os.path.join( 206 gtest_filter_base_path = os.path.join(
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 self.StripAndCopyFiles() 286 self.StripAndCopyFiles()
275 self.LaunchHelperToolsForTestSuite() 287 self.LaunchHelperToolsForTestSuite()
276 self.tool.SetupEnvironment() 288 self.tool.SetupEnvironment()
277 289
278 def TearDown(self): 290 def TearDown(self):
279 """Cleans up the test enviroment for the test suite.""" 291 """Cleans up the test enviroment for the test suite."""
280 self.tool.CleanUpEnvironment() 292 self.tool.CleanUpEnvironment()
281 if self.test_package.cleanup_test_files: 293 if self.test_package.cleanup_test_files:
282 self.adb.RemovePushedFiles() 294 self.adb.RemovePushedFiles()
283 super(TestRunner, self).TearDown() 295 super(TestRunner, self).TearDown()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698