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

Unified Diff: tools/chrome_remote_control/chrome_remote_control/cros_interface.py

Issue 11231087: Removing flake in TemporaryHTTPServer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
Index: tools/chrome_remote_control/chrome_remote_control/cros_interface.py
diff --git a/tools/chrome_remote_control/chrome_remote_control/cros_interface.py b/tools/chrome_remote_control/chrome_remote_control/cros_interface.py
index b03356f220cdd987869d65397d8ae0faea0087a1..4672f9fb33d98ccbe832cfb5c875a409d5c66c17 100644
--- a/tools/chrome_remote_control/chrome_remote_control/cros_interface.py
+++ b/tools/chrome_remote_control/chrome_remote_control/cros_interface.py
@@ -368,8 +368,15 @@ class CrOSInterface(object):
logging.debug("GetCmdOutput(%s)->%s" % (repr(args), stdout))
return stdout
+ def RunRemotePython(self, pycmd):
dtu 2012/10/23 22:15:04 Only test images have Python. Ideally we'd like CR
hartmanng 2012/11/19 18:49:13 Done.
+ return self.GetAllCmdOutput(['python', '-c', '"%s"' % pycmd])
+
nduca 2012/11/06 04:28:01 GetRemotePort should come with a unit test.
hartmanng 2012/11/19 18:49:13 Done.
def GetRemotePort(self):
- global _next_remote_port
- port = _next_remote_port
- _next_remote_port += 1
+ pycmd = """import socket
+tmp = socket.socket()
+tmp.bind(('',0))
+print tmp.getsockname()[1]
+tmp.close()"""
+
+ port = int(self.RunRemotePython(pycmd)[0].strip())
return port

Powered by Google App Engine
This is Rietveld 408576698