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

Unified Diff: tools/telemetry/telemetry/util.py

Issue 12052024: [Telemetry] Dynamically set remote debugging port in DesktopBrowserBackend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/GetLocalPort/GetAvailableLocalPort/ Created 7 years, 11 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 | « tools/telemetry/telemetry/temporary_http_server.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/util.py
diff --git a/tools/telemetry/telemetry/util.py b/tools/telemetry/telemetry/util.py
index e7b754b31d3872ba201ea258aa180a7419adb750..db93bcf79cb22d8c54be83016febb60dae8fd84d 100644
--- a/tools/telemetry/telemetry/util.py
+++ b/tools/telemetry/telemetry/util.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import inspect
+import socket
import time
class TimeoutException(Exception):
@@ -57,3 +58,11 @@ class PortPair(object):
def __init__(self, local_port, remote_port):
self.local_port = local_port
self.remote_port = remote_port
+
+def GetAvailableLocalPort():
+ tmp = socket.socket()
+ tmp.bind(('', 0))
+ port = tmp.getsockname()[1]
+ tmp.close()
+
+ return port
« no previous file with comments | « tools/telemetry/telemetry/temporary_http_server.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698