Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: build/android/pylib/chrome_test_server_spawner.py

Issue 15008004: Add device port unmapping support to forwarder2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address David's comments Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | build/android/pylib/forwarder.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 if device_port and _CheckDevicePortStatus(self.adb, device_port): 249 if device_port and _CheckDevicePortStatus(self.adb, device_port):
250 self.is_ready = True 250 self.is_ready = True
251 self.forwarder_device_port = device_port 251 self.forwarder_device_port = device_port
252 # Wake up the request handler thread. 252 # Wake up the request handler thread.
253 self.ready_event.set() 253 self.ready_event.set()
254 # Keep thread running until Stop() gets called. 254 # Keep thread running until Stop() gets called.
255 _WaitUntil(lambda: self.stop_flag, max_attempts=sys.maxint) 255 _WaitUntil(lambda: self.stop_flag, max_attempts=sys.maxint)
256 if self.process.poll() is None: 256 if self.process.poll() is None:
257 self.process.kill() 257 self.process.kill()
258 if self._test_server_forwarder: 258 if self._test_server_forwarder:
259 self._test_server_forwarder.Close() 259 self._test_server_forwarder.UnmapDevicePort(self.forwarder_device_port)
260 self.process = None 260 self.process = None
261 self.is_ready = False 261 self.is_ready = False
262 if self.pipe_out: 262 if self.pipe_out:
263 os.close(self.pipe_in) 263 os.close(self.pipe_in)
264 os.close(self.pipe_out) 264 os.close(self.pipe_out)
265 self.pipe_in = None 265 self.pipe_in = None
266 self.pipe_out = None 266 self.pipe_out = None
267 logging.info('Test-server has died.') 267 logging.info('Test-server has died.')
268 self.wait_event.set() 268 self.wait_event.set()
269 269
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 423
424 def CleanupState(self): 424 def CleanupState(self):
425 """Cleans up the spawning server state. 425 """Cleans up the spawning server state.
426 426
427 This should be called if the test server spawner is reused, 427 This should be called if the test server spawner is reused,
428 to avoid sharing the test server instance. 428 to avoid sharing the test server instance.
429 """ 429 """
430 if self.server.test_server_instance: 430 if self.server.test_server_instance:
431 self.server.test_server_instance.Stop() 431 self.server.test_server_instance.Stop()
432 self.server.test_server_instance = None 432 self.server.test_server_instance = None
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/forwarder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698