| 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 """A "Test Server Spawner" that handles killing/stopping per-test test servers. | 5 """A "Test Server Spawner" that handles killing/stopping per-test test servers. |
| 6 | 6 |
| 7 It's used to accept requests from the device to spawn and kill instances of the | 7 It's used to accept requests from the device to spawn and kill instances of the |
| 8 chrome test server on the host. | 8 chrome test server on the host. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 self.command_line.append('--ssl-client-ca=%s' % | 200 self.command_line.append('--ssl-client-ca=%s' % |
| 201 os.path.join(constants.CHROME_DIR, ca)) | 201 os.path.join(constants.CHROME_DIR, ca)) |
| 202 if self.arguments.has_key('ssl-bulk-cipher'): | 202 if self.arguments.has_key('ssl-bulk-cipher'): |
| 203 for bulk_cipher in self.arguments['ssl-bulk-cipher']: | 203 for bulk_cipher in self.arguments['ssl-bulk-cipher']: |
| 204 self.command_line.append('--ssl-bulk-cipher=%s' % bulk_cipher) | 204 self.command_line.append('--ssl-bulk-cipher=%s' % bulk_cipher) |
| 205 | 205 |
| 206 def run(self): | 206 def run(self): |
| 207 logging.info('Start running the thread!') | 207 logging.info('Start running the thread!') |
| 208 self.wait_event.clear() | 208 self.wait_event.clear() |
| 209 self._GenerateCommandLineArguments() | 209 self._GenerateCommandLineArguments() |
| 210 command = '%s %s' % ( | 210 command = [os.path.join(constants.CHROME_DIR, 'net', 'tools', |
| 211 os.path.join(constants.CHROME_DIR, 'net', 'tools', 'testserver', | 211 'testserver', 'testserver.py')] + self.command_line |
| 212 'testserver.py'), | 212 logging.info('Running: %s', command) |
| 213 ' '.join(self.command_line)) | 213 self.process = subprocess.Popen(command) |
| 214 logging.info(command) | |
| 215 self.process = subprocess.Popen(command, shell=True) | |
| 216 if self.process: | 214 if self.process: |
| 217 if self.pipe_out: | 215 if self.pipe_out: |
| 218 self.is_ready = self._WaitToStartAndGetPortFromTestServer() | 216 self.is_ready = self._WaitToStartAndGetPortFromTestServer() |
| 219 else: | 217 else: |
| 220 self.is_ready = _CheckPortStatus(self.host_port, True) | 218 self.is_ready = _CheckPortStatus(self.host_port, True) |
| 221 if self.is_ready: | 219 if self.is_ready: |
| 222 self._test_server_forwarder = Forwarder( | 220 self._test_server_forwarder = Forwarder( |
| 223 self.adb, [(0, self.host_port)], self.tool, '127.0.0.1', | 221 self.adb, [(0, self.host_port)], self.tool, '127.0.0.1', |
| 224 self.build_type) | 222 self.build_type) |
| 225 # Check whether the forwarder is ready on the device. | 223 # Check whether the forwarder is ready on the device. |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 def Start(self): | 393 def Start(self): |
| 396 listener_thread = threading.Thread(target=self._Listen) | 394 listener_thread = threading.Thread(target=self._Listen) |
| 397 listener_thread.setDaemon(True) | 395 listener_thread.setDaemon(True) |
| 398 listener_thread.start() | 396 listener_thread.start() |
| 399 time.sleep(1) | 397 time.sleep(1) |
| 400 | 398 |
| 401 def Stop(self): | 399 def Stop(self): |
| 402 if self.server.test_server_instance: | 400 if self.server.test_server_instance: |
| 403 self.server.test_server_instance.Stop() | 401 self.server.test_server_instance.Stop() |
| 404 self.server.shutdown() | 402 self.server.shutdown() |
| OLD | NEW |