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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 | 95 |
96 def __init__(self, test_server_spawner_port, test_server_port): | 96 def __init__(self, test_server_spawner_port, test_server_port): |
97 logging.info('Creating new spawner %d', test_server_spawner_port) | 97 logging.info('Creating new spawner %d', test_server_spawner_port) |
98 self.server = testserver.StoppableHTTPServer(('', test_server_spawner_port), | 98 self.server = testserver.StoppableHTTPServer(('', test_server_spawner_port), |
99 SpawningServerRequestHandler) | 99 SpawningServerRequestHandler) |
100 self.port = test_server_spawner_port | 100 self.port = test_server_spawner_port |
101 self.server.test_server_port = test_server_port | 101 self.server.test_server_port = test_server_port |
102 | 102 |
103 def Listen(self): | 103 def Listen(self): |
104 logging.info('Starting test server spawner') | 104 logging.info('Starting test server spawner') |
105 self.server.serve_forever() | |
Satish
2012/08/20 11:24:31
how is this change related to the rest of this CL?
Xianzhu
2012/08/20 17:54:58
Thanks for the catch! Fixed.
| |
106 | 105 |
107 def Start(self): | 106 def Start(self): |
108 listener_thread = threading.Thread(target=self.Listen) | 107 listener_thread = threading.Thread(target=self.Listen) |
109 listener_thread.setDaemon(True) | 108 listener_thread.setDaemon(True) |
110 listener_thread.start() | 109 listener_thread.start() |
111 time.sleep(1) | 110 time.sleep(1) |
112 | 111 |
113 def Stop(self): | 112 def Stop(self): |
114 self.server.Stop() | 113 self.server.Stop() |
OLD | NEW |