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

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

Issue 3078031: Simple offline startup integration test. (Closed)
Patch Set: Disable test. Created 10 years, 4 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
« no previous file with comments | « net/tools/testserver/chromiumsync.py ('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/python2.4 1 #!/usr/bin/python2.4
2 # Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2010 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 server used for testing Chrome. 6 """This is a simple HTTP server used for testing Chrome.
7 7
8 It supports several test URLs, as specified by the handlers in TestPageHandler. 8 It supports several test URLs, as specified by the handlers in TestPageHandler.
9 It defaults to living on localhost:8888. 9 It defaults to living on localhost:8888.
10 It can use https if you specify the flag --https=CERT where CERT is the path 10 It can use https if you specify the flag --https=CERT where CERT is the path
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 self.ContentTypeHandler, 120 self.ContentTypeHandler,
121 self.ServerRedirectHandler, 121 self.ServerRedirectHandler,
122 self.ClientRedirectHandler, 122 self.ClientRedirectHandler,
123 self.ChromiumSyncTimeHandler, 123 self.ChromiumSyncTimeHandler,
124 self.MultipartHandler, 124 self.MultipartHandler,
125 self.DefaultResponseHandler] 125 self.DefaultResponseHandler]
126 self._post_handlers = [ 126 self._post_handlers = [
127 self.WriteFile, 127 self.WriteFile,
128 self.EchoTitleHandler, 128 self.EchoTitleHandler,
129 self.EchoAllHandler, 129 self.EchoAllHandler,
130 self.ChromiumSyncConfigureHandler,
130 self.ChromiumSyncCommandHandler, 131 self.ChromiumSyncCommandHandler,
131 self.EchoHandler] + self._get_handlers 132 self.EchoHandler] + self._get_handlers
132 self._put_handlers = [ 133 self._put_handlers = [
133 self.WriteFile, 134 self.WriteFile,
134 self.EchoTitleHandler, 135 self.EchoTitleHandler,
135 self.EchoAllHandler, 136 self.EchoAllHandler,
136 self.EchoHandler] + self._get_handlers 137 self.EchoHandler] + self._get_handlers
137 138
138 self._mime_types = { 139 self._mime_types = {
139 'gif': 'image/gif', 140 'gif': 'image/gif',
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 """ 1001 """
1001 test_name = "/chromiumsync/time" 1002 test_name = "/chromiumsync/time"
1002 if not self._ShouldHandleRequest(test_name): 1003 if not self._ShouldHandleRequest(test_name):
1003 return False 1004 return False
1004 1005
1005 self.send_response(200) 1006 self.send_response(200)
1006 self.send_header('Content-type', 'text/html') 1007 self.send_header('Content-type', 'text/html')
1007 self.end_headers() 1008 self.end_headers()
1008 return True 1009 return True
1009 1010
1011 def ChromiumSyncConfigureHandler(self):
1012 """Handle updating the configuration of the sync server.
1013
1014 The name and value pairs of the post payload will update the
1015 configuration of the sync server. Supported tuples are:
1016 user_email,<email address> - Sets the email for the fake user account
1017 """
1018 test_name = "/chromiumsync/configure"
1019 if not self._ShouldHandleRequest(test_name):
1020 return False
1021
1022 length = int(self.headers.getheader('content-length'))
1023 raw_request = self.rfile.read(length)
1024 config = cgi.parse_qs(raw_request, keep_blank_values=1)
1025
1026 success = self._sync_handler.HandleConfigure(config)
1027 if success:
1028 self.send_response(200)
1029 else:
1030 self.send_response(500)
1031 self.end_headers()
1032 return True
1033
1010 def ChromiumSyncCommandHandler(self): 1034 def ChromiumSyncCommandHandler(self):
1011 """Handle a chromiumsync command arriving via http. 1035 """Handle a chromiumsync command arriving via http.
1012 1036
1013 This covers all sync protocol commands: authentication, getupdates, and 1037 This covers all sync protocol commands: authentication, getupdates, and
1014 commit. 1038 commit.
1015 """ 1039 """
1016 test_name = "/chromiumsync/command" 1040 test_name = "/chromiumsync/command"
1017 if not self._ShouldHandleRequest(test_name): 1041 if not self._ShouldHandleRequest(test_name):
1018 return False 1042 return False
1019 1043
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 option_parser.add_option('', '--file-root-url', default='/files/', 1288 option_parser.add_option('', '--file-root-url', default='/files/',
1265 help='Specify a root URL for files served.') 1289 help='Specify a root URL for files served.')
1266 option_parser.add_option('', '--never-die', default=False, 1290 option_parser.add_option('', '--never-die', default=False,
1267 action="store_true", 1291 action="store_true",
1268 help='Prevent the server from dying when visiting ' 1292 help='Prevent the server from dying when visiting '
1269 'a /kill URL. Useful for manually running some ' 1293 'a /kill URL. Useful for manually running some '
1270 'tests.') 1294 'tests.')
1271 options, args = option_parser.parse_args() 1295 options, args = option_parser.parse_args()
1272 1296
1273 sys.exit(main(options, args)) 1297 sys.exit(main(options, args))
OLDNEW
« no previous file with comments | « net/tools/testserver/chromiumsync.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698