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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 # because it may have race condition when multiple processes are trying to | 149 # because it may have race condition when multiple processes are trying to |
150 # launch lighttpd with same port at same time. | 150 # launch lighttpd with same port at same time. |
151 http_server_ports = self.LaunchTestHttpServer( | 151 http_server_ports = self.LaunchTestHttpServer( |
152 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) | 152 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) |
153 if self.ports_to_forward: | 153 if self.ports_to_forward: |
154 port_pairs = [(port, port) for port in self.ports_to_forward] | 154 port_pairs = [(port, port) for port in self.ports_to_forward] |
155 # We need to remember which ports the HTTP server is using, since the | 155 # We need to remember which ports the HTTP server is using, since the |
156 # forwarder will stomp on them otherwise. | 156 # forwarder will stomp on them otherwise. |
157 port_pairs.append(http_server_ports) | 157 port_pairs.append(http_server_ports) |
158 self.forwarder = forwarder.Forwarder(self.adb, self.build_type) | 158 self.forwarder = forwarder.Forwarder(self.adb, self.build_type) |
159 self.forwarder.Run(port_pairs, self.tool, '127.0.0.1') | 159 self.forwarder.Run(port_pairs, self.tool) |
160 self.flags.AddFlags(['--enable-test-intents']) | 160 self.flags.AddFlags(['--enable-test-intents']) |
161 | 161 |
162 def TearDown(self): | 162 def TearDown(self): |
163 """Cleans up the test harness and saves outstanding data from test run.""" | 163 """Cleans up the test harness and saves outstanding data from test run.""" |
164 if self.forwarder: | 164 if self.forwarder: |
165 self.forwarder.Close() | 165 self.forwarder.Close() |
166 super(TestRunner, self).TearDown() | 166 super(TestRunner, self).TearDown() |
167 | 167 |
168 def TestSetup(self, test): | 168 def TestSetup(self, test): |
169 """Sets up the test harness for running a particular test. | 169 """Sets up the test harness for running a particular test. |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 duration_ms = 0 | 356 duration_ms = 0 |
357 message = str(e) | 357 message = str(e) |
358 if not message: | 358 if not message: |
359 message = 'No information.' | 359 message = 'No information.' |
360 results.AddResult(test_result.InstrumentationTestResult( | 360 results.AddResult(test_result.InstrumentationTestResult( |
361 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, | 361 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, |
362 log=message)) | 362 log=message)) |
363 raw_result = None | 363 raw_result = None |
364 self.TestTeardown(test, raw_result) | 364 self.TestTeardown(test, raw_result) |
365 return (results, None if results.DidRunPass() else test) | 365 return (results, None if results.DidRunPass() else test) |
OLD | NEW |