Chromium Code Reviews| 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 |