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

Unified Diff: net/tools/testserver/testserver.py

Issue 10388206: [sync] Add --port and --xmpp-port parameters to run_testserver.cc (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/testserver/run_testserver.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/testserver/testserver.py
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index 82e9b612d743bd57e6ad5dd0533ad56e9a34b6ec..2a0284a7d71e53c653b38e37851d85eb97d8b10a 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -180,7 +180,7 @@ class HTTPSServer(tlslite.api.TLSSocketServerMixIn,
class SyncHTTPServer(ClientRestrictingServerMixIn, StoppableHTTPServer):
"""An HTTP server that handles sync commands."""
- def __init__(self, server_address, request_handler_class):
+ def __init__(self, server_address, xmpp_port, request_handler_class):
# We import here to avoid pulling in chromiumsync's dependencies
# unless strictly necessary.
import chromiumsync
@@ -189,7 +189,7 @@ class SyncHTTPServer(ClientRestrictingServerMixIn, StoppableHTTPServer):
self._sync_handler = chromiumsync.TestServer()
self._xmpp_socket_map = {}
self._xmpp_server = xmppserver.XmppServer(
- self._xmpp_socket_map, ('localhost', 0))
+ self._xmpp_socket_map, ('localhost', xmpp_port))
self.xmpp_port = self._xmpp_server.getsockname()[1]
self.authenticated = True
@@ -2063,7 +2063,8 @@ def main(options, args):
server.policy_user = options.policy_user
server.gdata_auth_token = options.auth_token
elif options.server_type == SERVER_SYNC:
- server = SyncHTTPServer((host, port), SyncPageHandler)
+ xmpp_port = options.xmpp_port
+ server = SyncHTTPServer((host, port), xmpp_port, SyncPageHandler)
print 'Sync HTTP server started on port %d...' % server.server_port
print 'Sync XMPP server started on port %d...' % server.xmpp_port
server_data['port'] = server.server_port
@@ -2164,6 +2165,9 @@ if __name__ == '__main__':
option_parser.add_option('', '--port', default='0', type='int',
help='Port used by the server. If unspecified, the '
'server will listen on an ephemeral port.')
+ option_parser.add_option('', '--xmpp-port', default='0', type='int',
+ help='Port used by the XMPP server. If unspecified, '
+ 'the XMPP server will listen on an ephemeral port.')
option_parser.add_option('', '--data-dir', dest='data_dir',
help='Directory from which to read the files.')
option_parser.add_option('', '--https', action='store_true', dest='https',
« no previous file with comments | « net/tools/testserver/run_testserver.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698