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

Side by Side Diff: net/tools/testserver/testserver.py

Issue 706203003: Update from https://crrev.com/303153 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """This is a simple HTTP/FTP/TCP/UDP/BASIC_AUTH_PROXY/WEBSOCKET server used for 6 """This is a simple HTTP/FTP/TCP/UDP/BASIC_AUTH_PROXY/WEBSOCKET server used for
7 testing Chrome. 7 testing Chrome.
8 8
9 It supports several test URLs, as specified by the handlers in TestPageHandler. 9 It supports several test URLs, as specified by the handlers in TestPageHandler.
10 By default, it listens on an ephemeral port and sends the port number back to 10 By default, it listens on an ephemeral port and sends the port number back to
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 return True 1421 return True
1422 1422
1423 def CrossSiteRedirectHandler(self): 1423 def CrossSiteRedirectHandler(self):
1424 """Sends a server redirect to the given site. The syntax is 1424 """Sends a server redirect to the given site. The syntax is
1425 '/cross-site/hostname/...' to redirect to //hostname/... 1425 '/cross-site/hostname/...' to redirect to //hostname/...
1426 It is used to navigate between different Sites, causing 1426 It is used to navigate between different Sites, causing
1427 cross-site/cross-process navigations in the browser.""" 1427 cross-site/cross-process navigations in the browser."""
1428 1428
1429 test_name = "/cross-site" 1429 test_name = "/cross-site"
1430 if not self._ShouldHandleRequest(test_name): 1430 if not self._ShouldHandleRequest(test_name):
1431 print "CSRH: not handling request for " + test_name
1432 return False 1431 return False
1433 1432
1434 params = urllib.unquote(self.path[(len(test_name) + 1):]) 1433 params = urllib.unquote(self.path[(len(test_name) + 1):])
1435 slash = params.find('/') 1434 slash = params.find('/')
1436 if slash < 0: 1435 if slash < 0:
1437 self.sendRedirectHelp(test_name) 1436 self.sendRedirectHelp(test_name)
1438 return True 1437 return True
1439 1438
1440 host = params[:slash] 1439 host = params[:slash]
1441 path = params[(slash+1):] 1440 path = params[(slash+1):]
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
2267 self.option_parser.add_option('--file-root-url', default='/files/', 2266 self.option_parser.add_option('--file-root-url', default='/files/',
2268 help='Specify a root URL for files served.') 2267 help='Specify a root URL for files served.')
2269 # TODO(ricea): Generalize this to support basic auth for HTTP too. 2268 # TODO(ricea): Generalize this to support basic auth for HTTP too.
2270 self.option_parser.add_option('--ws-basic-auth', action='store_true', 2269 self.option_parser.add_option('--ws-basic-auth', action='store_true',
2271 dest='ws_basic_auth', 2270 dest='ws_basic_auth',
2272 help='Enable basic-auth for WebSocket') 2271 help='Enable basic-auth for WebSocket')
2273 2272
2274 2273
2275 if __name__ == '__main__': 2274 if __name__ == '__main__':
2276 sys.exit(ServerRunner().main()) 2275 sys.exit(ServerRunner().main())
OLDNEW
« no previous file with comments | « net/tools/quic/test_tools/quic_test_utils.cc ('k') | net/tools/tld_cleanup/tld_cleanup_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698