OLD | NEW |
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 """Runs the Java tests. See more information on run_instrumentation_tests.py.""" | 5 """Runs the Java tests. See more information on run_instrumentation_tests.py.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import re | 9 import re |
10 import shutil | 10 import shutil |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 def SetUp(self): | 199 def SetUp(self): |
200 """Sets up the test harness and device before all tests are run.""" | 200 """Sets up the test harness and device before all tests are run.""" |
201 super(TestRunner, self).SetUp() | 201 super(TestRunner, self).SetUp() |
202 if not self.adb.IsRootEnabled(): | 202 if not self.adb.IsRootEnabled(): |
203 logging.warning('Unable to enable java asserts for %s, non rooted device', | 203 logging.warning('Unable to enable java asserts for %s, non rooted device', |
204 self.device) | 204 self.device) |
205 else: | 205 else: |
206 if self.adb.SetJavaAssertsEnabled(enable=not self.disable_assertions): | 206 if self.adb.SetJavaAssertsEnabled(enable=not self.disable_assertions): |
207 self.adb.Reboot(full_reboot=False) | 207 self.adb.Reboot(full_reboot=False) |
208 | 208 |
| 209 self.CopyTestFilesOnce() |
209 # We give different default value to launch HTTP server based on shard index | 210 # We give different default value to launch HTTP server based on shard index |
210 # because it may have race condition when multiple processes are trying to | 211 # because it may have race condition when multiple processes are trying to |
211 # launch lighttpd with same port at same time. | 212 # launch lighttpd with same port at same time. |
212 http_server_ports = self.LaunchTestHttpServer( | 213 http_server_ports = self.LaunchTestHttpServer( |
213 os.path.join(constants.CHROME_DIR), self._lighttp_port) | 214 os.path.join(constants.CHROME_DIR), self._lighttp_port) |
214 if self.ports_to_forward: | 215 if self.ports_to_forward: |
215 port_pairs = [(port, port) for port in self.ports_to_forward] | 216 port_pairs = [(port, port) for port in self.ports_to_forward] |
216 # We need to remember which ports the HTTP server is using, since the | 217 # We need to remember which ports the HTTP server is using, since the |
217 # forwarder will stomp on them otherwise. | 218 # forwarder will stomp on them otherwise. |
218 port_pairs.append(http_server_ports) | 219 port_pairs.append(http_server_ports) |
219 self.forwarder = forwarder.Forwarder(self.adb, self.build_type) | 220 self.forwarder = forwarder.Forwarder(self.adb, self.build_type) |
220 self.forwarder.Run(port_pairs, self.tool, '127.0.0.1') | 221 self.forwarder.Run(port_pairs, self.tool, '127.0.0.1') |
221 self.CopyTestFilesOnce() | |
222 self.flags.AddFlags(['--enable-test-intents']) | 222 self.flags.AddFlags(['--enable-test-intents']) |
223 | 223 |
224 def TearDown(self): | 224 def TearDown(self): |
225 """Cleans up the test harness and saves outstanding data from test run.""" | 225 """Cleans up the test harness and saves outstanding data from test run.""" |
226 if self.forwarder: | 226 if self.forwarder: |
227 self.forwarder.Close() | 227 self.forwarder.Close() |
228 self.GenerateCoverageReportIfNeeded() | 228 self.GenerateCoverageReportIfNeeded() |
229 super(TestRunner, self).TearDown() | 229 super(TestRunner, self).TearDown() |
230 | 230 |
231 def TestSetup(self, test): | 231 def TestSetup(self, test): |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 duration_ms = 0 | 426 duration_ms = 0 |
427 message = str(e) | 427 message = str(e) |
428 if not message: | 428 if not message: |
429 message = 'No information.' | 429 message = 'No information.' |
430 results.AddResult(test_result.InstrumentationTestResult( | 430 results.AddResult(test_result.InstrumentationTestResult( |
431 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, | 431 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, |
432 log=message)) | 432 log=message)) |
433 raw_result = None | 433 raw_result = None |
434 self.TestTeardown(test, raw_result) | 434 self.TestTeardown(test, raw_result) |
435 return (results, None if results.DidRunPass() else test) | 435 return (results, None if results.DidRunPass() else test) |
OLD | NEW |