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

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

Issue 316663003: Remove multipart_browsertest.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 self.ExpectAndSetCookieHandler, 322 self.ExpectAndSetCookieHandler,
323 self.SetHeaderHandler, 323 self.SetHeaderHandler,
324 self.AuthBasicHandler, 324 self.AuthBasicHandler,
325 self.AuthDigestHandler, 325 self.AuthDigestHandler,
326 self.SlowServerHandler, 326 self.SlowServerHandler,
327 self.ChunkedServerHandler, 327 self.ChunkedServerHandler,
328 self.ContentTypeHandler, 328 self.ContentTypeHandler,
329 self.NoContentHandler, 329 self.NoContentHandler,
330 self.ServerRedirectHandler, 330 self.ServerRedirectHandler,
331 self.ClientRedirectHandler, 331 self.ClientRedirectHandler,
332 self.MultipartHandler,
333 self.GetSSLSessionCacheHandler, 332 self.GetSSLSessionCacheHandler,
334 self.SSLManySmallRecords, 333 self.SSLManySmallRecords,
335 self.GetChannelID, 334 self.GetChannelID,
336 self.CloseSocketHandler, 335 self.CloseSocketHandler,
337 self.RangeResetHandler, 336 self.RangeResetHandler,
338 self.DefaultResponseHandler] 337 self.DefaultResponseHandler]
339 post_handlers = [ 338 post_handlers = [
340 self.EchoTitleHandler, 339 self.EchoTitleHandler,
341 self.EchoHandler, 340 self.EchoHandler,
342 self.PostOnlyFileHandler, 341 self.PostOnlyFileHandler,
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 1431
1433 self.send_response(200) 1432 self.send_response(200)
1434 self.send_header('Content-Type', 'text/html') 1433 self.send_header('Content-Type', 'text/html')
1435 self.end_headers() 1434 self.end_headers()
1436 self.wfile.write('<html><head>') 1435 self.wfile.write('<html><head>')
1437 self.wfile.write('<meta http-equiv="refresh" content="0;url=%s">' % dest) 1436 self.wfile.write('<meta http-equiv="refresh" content="0;url=%s">' % dest)
1438 self.wfile.write('</head><body>Redirecting to %s</body></html>' % dest) 1437 self.wfile.write('</head><body>Redirecting to %s</body></html>' % dest)
1439 1438
1440 return True 1439 return True
1441 1440
1442 def MultipartHandler(self):
1443 """Send a multipart response (10 text/html pages)."""
1444
1445 test_name = '/multipart'
1446 if not self._ShouldHandleRequest(test_name):
1447 return False
1448
1449 num_frames = 10
1450 bound = '12345'
1451 self.send_response(200)
1452 self.send_header('Content-Type',
1453 'multipart/x-mixed-replace;boundary=' + bound)
1454 self.end_headers()
1455
1456 for i in xrange(num_frames):
1457 self.wfile.write('--' + bound + '\r\n')
1458 self.wfile.write('Content-Type: text/html\r\n\r\n')
1459 self.wfile.write('<title>page ' + str(i) + '</title>')
1460 self.wfile.write('page ' + str(i))
1461
1462 self.wfile.write('--' + bound + '--')
1463 return True
1464
1465 def GetSSLSessionCacheHandler(self): 1441 def GetSSLSessionCacheHandler(self):
1466 """Send a reply containing a log of the session cache operations.""" 1442 """Send a reply containing a log of the session cache operations."""
1467 1443
1468 if not self._ShouldHandleRequest('/ssl-session-cache'): 1444 if not self._ShouldHandleRequest('/ssl-session-cache'):
1469 return False 1445 return False
1470 1446
1471 self.send_response(200) 1447 self.send_response(200)
1472 self.send_header('Content-Type', 'text/plain') 1448 self.send_header('Content-Type', 'text/plain')
1473 self.end_headers() 1449 self.end_headers()
1474 try: 1450 try:
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
2220 action='store_const', 2196 action='store_const',
2221 help='Enable server support for the NPN ' 2197 help='Enable server support for the NPN '
2222 'extension. The server will advertise ' 2198 'extension. The server will advertise '
2223 'support for exactly one protocol, http/1.1') 2199 'support for exactly one protocol, http/1.1')
2224 self.option_parser.add_option('--file-root-url', default='/files/', 2200 self.option_parser.add_option('--file-root-url', default='/files/',
2225 help='Specify a root URL for files served.') 2201 help='Specify a root URL for files served.')
2226 2202
2227 2203
2228 if __name__ == '__main__': 2204 if __name__ == '__main__':
2229 sys.exit(ServerRunner().main()) 2205 sys.exit(ServerRunner().main())
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698