| 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 """Class for running instrumentation tests on a single device.""" | 5 """Class for running instrumentation tests on a single device.""" |
| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 # launch lighttpd with same port at same time. | 152 # launch lighttpd with same port at same time. |
| 153 http_server_ports = self.LaunchTestHttpServer( | 153 http_server_ports = self.LaunchTestHttpServer( |
| 154 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) | 154 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) |
| 155 if self.ports_to_forward: | 155 if self.ports_to_forward: |
| 156 self.ForwardPorts([(port, port) for port in self.ports_to_forward]) | 156 self.ForwardPorts([(port, port) for port in self.ports_to_forward]) |
| 157 self.flags.AddFlags(['--enable-test-intents']) | 157 self.flags.AddFlags(['--enable-test-intents']) |
| 158 | 158 |
| 159 def TearDown(self): | 159 def TearDown(self): |
| 160 """Cleans up the test harness and saves outstanding data from test run.""" | 160 """Cleans up the test harness and saves outstanding data from test run.""" |
| 161 if self.ports_to_forward: | 161 if self.ports_to_forward: |
| 162 self._UnmapPortPairs(self.ports_to_forward) | 162 self._UnmapPorts([(port, port) for port in self.ports_to_forward]) |
| 163 super(TestRunner, self).TearDown() | 163 super(TestRunner, self).TearDown() |
| 164 | 164 |
| 165 def TestSetup(self, test): | 165 def TestSetup(self, test): |
| 166 """Sets up the test harness for running a particular test. | 166 """Sets up the test harness for running a particular test. |
| 167 | 167 |
| 168 Args: | 168 Args: |
| 169 test: The name of the test that will be run. | 169 test: The name of the test that will be run. |
| 170 """ | 170 """ |
| 171 self.SetupPerfMonitoringIfNeeded(test) | 171 self.SetupPerfMonitoringIfNeeded(test) |
| 172 self._SetupIndividualTestTimeoutScale(test) | 172 self._SetupIndividualTestTimeoutScale(test) |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 duration_ms = 0 | 353 duration_ms = 0 |
| 354 message = str(e) | 354 message = str(e) |
| 355 if not message: | 355 if not message: |
| 356 message = 'No information.' | 356 message = 'No information.' |
| 357 results.AddResult(test_result.InstrumentationTestResult( | 357 results.AddResult(test_result.InstrumentationTestResult( |
| 358 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, | 358 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, |
| 359 log=message)) | 359 log=message)) |
| 360 raw_result = None | 360 raw_result = None |
| 361 self.TestTeardown(test, raw_result) | 361 self.TestTeardown(test, raw_result) |
| 362 return (results, None if results.DidRunPass() else test) | 362 return (results, None if results.DidRunPass() else test) |
| OLD | NEW |