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

Unified Diff: trunk/src/build/android/pylib/chrome_test_server_spawner.py

Issue 19576005: Revert 212020 "Move Python setup/tear down logic into Forwarder ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/build/android/pylib/base/shard.py ('k') | trunk/src/build/android/pylib/forwarder.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/build/android/pylib/chrome_test_server_spawner.py
===================================================================
--- trunk/src/build/android/pylib/chrome_test_server_spawner.py (revision 212053)
+++ trunk/src/build/android/pylib/chrome_test_server_spawner.py (working copy)
@@ -23,7 +23,6 @@
import constants
import ports
-from pylib.forwarder import Forwarder
# Path that are needed to import necessary modules when launching a testserver.
os.environ['PYTHONPATH'] = os.environ.get('PYTHONPATH', '') + (':%s:%s:%s:%s:%s'
@@ -100,7 +99,7 @@
class TestServerThread(threading.Thread):
"""A thread to run the test server in a separate process."""
- def __init__(self, ready_event, arguments, adb, tool, build_type):
+ def __init__(self, ready_event, arguments, adb, tool, forwarder, build_type):
"""Initialize TestServerThread with the following argument.
Args:
@@ -108,6 +107,7 @@
arguments: dictionary of arguments to run the test server.
adb: instance of AndroidCommands.
tool: instance of runtime error detection tool.
+ forwarder: instance of Forwarder.
build_type: 'Release' or 'Debug'.
"""
threading.Thread.__init__(self)
@@ -122,6 +122,7 @@
self.is_ready = False
self.host_port = self.arguments['port']
assert isinstance(self.host_port, int)
+ self._test_server_forwarder = forwarder
# The forwarder device port now is dynamically allocated.
self.forwarder_device_port = 0
# Anonymous pipe in order to get port info from test server.
@@ -239,10 +240,11 @@
else:
self.is_ready = _CheckPortStatus(self.host_port, True)
if self.is_ready:
- Forwarder.Map([(0, self.host_port)], self.adb, self.build_type, self.tool)
+ self._test_server_forwarder.Run([(0, self.host_port)], self.tool)
# Check whether the forwarder is ready on the device.
self.is_ready = False
- device_port = Forwarder.DevicePortForHostPort(self.host_port)
+ device_port = self._test_server_forwarder.DevicePortForHostPort(
+ self.host_port)
if device_port and _CheckDevicePortStatus(self.adb, device_port):
self.is_ready = True
self.forwarder_device_port = device_port
@@ -252,7 +254,7 @@
_WaitUntil(lambda: self.stop_flag, max_attempts=sys.maxint)
if self.process.poll() is None:
self.process.kill()
- Forwarder.UnmapDevicePort(self.forwarder_device_port, self.adb)
+ self._test_server_forwarder.UnmapDevicePort(self.forwarder_device_port)
self.process = None
self.is_ready = False
if self.pipe_out:
@@ -322,6 +324,7 @@
json.loads(test_server_argument_json),
self.server.adb,
self.server.tool,
+ self.server.forwarder,
self.server.build_type)
self.server.test_server_instance.setDaemon(True)
self.server.test_server_instance.start()
@@ -389,12 +392,14 @@
class SpawningServer(object):
"""The class used to start/stop a http server."""
- def __init__(self, test_server_spawner_port, adb, tool, build_type):
+ def __init__(self, test_server_spawner_port, adb, tool, forwarder,
+ build_type):
logging.info('Creating new spawner on port: %d.', test_server_spawner_port)
self.server = BaseHTTPServer.HTTPServer(('', test_server_spawner_port),
SpawningServerRequestHandler)
self.server.adb = adb
self.server.tool = tool
+ self.server.forwarder = forwarder
self.server.test_server_instance = None
self.server.build_type = build_type
« no previous file with comments | « trunk/src/build/android/pylib/base/shard.py ('k') | trunk/src/build/android/pylib/forwarder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698