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

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

Issue 10235013: [Sync] Add support for automatic enabling of syncing tab favicons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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/SYNC/TCP/UDP/ server used for testing Chrome. 6 """This is a simple HTTP/FTP/SYNC/TCP/UDP/ 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 By default, it listens on an ephemeral port and sends the port number back to 9 By default, it listens on an ephemeral port and sends the port number back to
10 the originating process over a pipe. The originating process can specify an 10 the originating process over a pipe. The originating process can specify an
(...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 get_handlers = [self.ChromiumSyncTimeHandler, 1664 get_handlers = [self.ChromiumSyncTimeHandler,
1665 self.ChromiumSyncMigrationOpHandler, 1665 self.ChromiumSyncMigrationOpHandler,
1666 self.ChromiumSyncCredHandler, 1666 self.ChromiumSyncCredHandler,
1667 self.ChromiumSyncDisableNotificationsOpHandler, 1667 self.ChromiumSyncDisableNotificationsOpHandler,
1668 self.ChromiumSyncEnableNotificationsOpHandler, 1668 self.ChromiumSyncEnableNotificationsOpHandler,
1669 self.ChromiumSyncSendNotificationOpHandler, 1669 self.ChromiumSyncSendNotificationOpHandler,
1670 self.ChromiumSyncBirthdayErrorOpHandler, 1670 self.ChromiumSyncBirthdayErrorOpHandler,
1671 self.ChromiumSyncTransientErrorOpHandler, 1671 self.ChromiumSyncTransientErrorOpHandler,
1672 self.ChromiumSyncErrorOpHandler, 1672 self.ChromiumSyncErrorOpHandler,
1673 self.ChromiumSyncSyncTabsOpHandler, 1673 self.ChromiumSyncSyncTabsOpHandler,
1674 self.ChromiumSyncSyncTabFaviconsOpHandler,
1674 self.ChromiumSyncCreateSyncedBookmarksOpHandler] 1675 self.ChromiumSyncCreateSyncedBookmarksOpHandler]
1675 1676
1676 post_handlers = [self.ChromiumSyncCommandHandler, 1677 post_handlers = [self.ChromiumSyncCommandHandler,
1677 self.ChromiumSyncTimeHandler] 1678 self.ChromiumSyncTimeHandler]
1678 BasePageHandler.__init__(self, request, client_address, 1679 BasePageHandler.__init__(self, request, client_address,
1679 sync_http_server, [], get_handlers, [], 1680 sync_http_server, [], get_handlers, [],
1680 post_handlers, []) 1681 post_handlers, [])
1681 1682
1682 1683
1683 def ChromiumSyncTimeHandler(self): 1684 def ChromiumSyncTimeHandler(self):
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 if not self._ShouldHandleRequest(test_name): 1865 if not self._ShouldHandleRequest(test_name):
1865 return False 1866 return False
1866 result, raw_reply = self.server._sync_handler.HandleSetSyncTabs() 1867 result, raw_reply = self.server._sync_handler.HandleSetSyncTabs()
1867 self.send_response(result) 1868 self.send_response(result)
1868 self.send_header('Content-Type', 'text/html') 1869 self.send_header('Content-Type', 'text/html')
1869 self.send_header('Content-Length', len(raw_reply)) 1870 self.send_header('Content-Length', len(raw_reply))
1870 self.end_headers() 1871 self.end_headers()
1871 self.wfile.write(raw_reply) 1872 self.wfile.write(raw_reply)
1872 return True; 1873 return True;
1873 1874
1875 def ChromiumSyncSyncTabFaviconsOpHandler(self):
1876 test_name = "/chromiumsync/synctabfavicons"
1877 if not self._ShouldHandleRequest(test_name):
1878 return False
1879 result, raw_reply = self.server._sync_handler.HandleSetSyncTabFavicons()
1880 self.send_response(result)
1881 self.send_header('Content-Type', 'text/html')
1882 self.send_header('Content-Length', len(raw_reply))
1883 self.end_headers()
1884 self.wfile.write(raw_reply)
1885 return True;
1886
1874 def ChromiumSyncCreateSyncedBookmarksOpHandler(self): 1887 def ChromiumSyncCreateSyncedBookmarksOpHandler(self):
1875 test_name = "/chromiumsync/createsyncedbookmarks" 1888 test_name = "/chromiumsync/createsyncedbookmarks"
1876 if not self._ShouldHandleRequest(test_name): 1889 if not self._ShouldHandleRequest(test_name):
1877 return False 1890 return False
1878 result, raw_reply = self.server._sync_handler.HandleCreateSyncedBookmarks() 1891 result, raw_reply = self.server._sync_handler.HandleCreateSyncedBookmarks()
1879 self.send_response(result) 1892 self.send_response(result)
1880 self.send_header('Content-Type', 'text/html') 1893 self.send_header('Content-Type', 'text/html')
1881 self.send_header('Content-Length', len(raw_reply)) 1894 self.send_header('Content-Length', len(raw_reply))
1882 self.end_headers() 1895 self.end_headers()
1883 self.wfile.write(raw_reply) 1896 self.wfile.write(raw_reply)
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2217 dest='host', 2230 dest='host',
2218 help='Hostname or IP upon which the server will ' 2231 help='Hostname or IP upon which the server will '
2219 'listen. Client connections will also only be ' 2232 'listen. Client connections will also only be '
2220 'allowed from this address.') 2233 'allowed from this address.')
2221 option_parser.add_option('', '--auth-token', dest='auth_token', 2234 option_parser.add_option('', '--auth-token', dest='auth_token',
2222 help='Specify the auth token which should be used' 2235 help='Specify the auth token which should be used'
2223 'in the authorization header for GData.') 2236 'in the authorization header for GData.')
2224 options, args = option_parser.parse_args() 2237 options, args = option_parser.parse_args()
2225 2238
2226 sys.exit(main(options, args)) 2239 sys.exit(main(options, args))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698