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

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

Issue 9570055: [Sync] Add support for associating a new Synced Bookmarks node. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Stray character Created 8 years, 9 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 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 1593
1594 def __init__(self, request, client_address, sync_http_server): 1594 def __init__(self, request, client_address, sync_http_server):
1595 get_handlers = [self.ChromiumSyncMigrationOpHandler, 1595 get_handlers = [self.ChromiumSyncMigrationOpHandler,
1596 self.ChromiumSyncTimeHandler, 1596 self.ChromiumSyncTimeHandler,
1597 self.ChromiumSyncDisableNotificationsOpHandler, 1597 self.ChromiumSyncDisableNotificationsOpHandler,
1598 self.ChromiumSyncEnableNotificationsOpHandler, 1598 self.ChromiumSyncEnableNotificationsOpHandler,
1599 self.ChromiumSyncSendNotificationOpHandler, 1599 self.ChromiumSyncSendNotificationOpHandler,
1600 self.ChromiumSyncBirthdayErrorOpHandler, 1600 self.ChromiumSyncBirthdayErrorOpHandler,
1601 self.ChromiumSyncTransientErrorOpHandler, 1601 self.ChromiumSyncTransientErrorOpHandler,
1602 self.ChromiumSyncSyncTabsOpHandler, 1602 self.ChromiumSyncSyncTabsOpHandler,
1603 self.ChromiumSyncCreateSyncedBookmarksOpHandler,
1603 self.ChromiumSyncErrorOpHandler, 1604 self.ChromiumSyncErrorOpHandler,
1604 self.ChromiumSyncCredHandler] 1605 self.ChromiumSyncCredHandler]
1605 1606
1606 post_handlers = [self.ChromiumSyncCommandHandler, 1607 post_handlers = [self.ChromiumSyncCommandHandler,
1607 self.ChromiumSyncTimeHandler] 1608 self.ChromiumSyncTimeHandler]
1608 BasePageHandler.__init__(self, request, client_address, 1609 BasePageHandler.__init__(self, request, client_address,
1609 sync_http_server, [], get_handlers, [], 1610 sync_http_server, [], get_handlers, [],
1610 post_handlers, []) 1611 post_handlers, [])
1611 1612
1612 1613
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 if not self._ShouldHandleRequest(test_name): 1795 if not self._ShouldHandleRequest(test_name):
1795 return False 1796 return False
1796 result, raw_reply = self.server._sync_handler.HandleSetSyncTabs() 1797 result, raw_reply = self.server._sync_handler.HandleSetSyncTabs()
1797 self.send_response(result) 1798 self.send_response(result)
1798 self.send_header('Content-Type', 'text/html') 1799 self.send_header('Content-Type', 'text/html')
1799 self.send_header('Content-Length', len(raw_reply)) 1800 self.send_header('Content-Length', len(raw_reply))
1800 self.end_headers() 1801 self.end_headers()
1801 self.wfile.write(raw_reply) 1802 self.wfile.write(raw_reply)
1802 return True; 1803 return True;
1803 1804
1805 def ChromiumSyncCreateSyncedBookmarksOpHandler(self):
1806 test_name = "/chromiumsync/createsyncedbookmarks"
1807 if not self._ShouldHandleRequest(test_name):
1808 return False
1809 result, raw_reply = self.server._sync_handler.HandleCreateSyncedBookmarks()
1810 self.send_response(result)
1811 self.send_header('Content-Type', 'text/html')
1812 self.send_header('Content-Length', len(raw_reply))
1813 self.end_headers()
1814 self.wfile.write(raw_reply)
1815 return True;
1816
1804 1817
1805 def MakeDataDir(): 1818 def MakeDataDir():
1806 if options.data_dir: 1819 if options.data_dir:
1807 if not os.path.isdir(options.data_dir): 1820 if not os.path.isdir(options.data_dir):
1808 print 'specified data dir not found: ' + options.data_dir + ' exiting...' 1821 print 'specified data dir not found: ' + options.data_dir + ' exiting...'
1809 return None 1822 return None
1810 my_data_dir = options.data_dir 1823 my_data_dir = options.data_dir
1811 else: 1824 else:
1812 # Create the default path to our data dir, relative to the exe dir. 1825 # Create the default path to our data dir, relative to the exe dir.
1813 my_data_dir = os.path.dirname(sys.argv[0]) 1826 my_data_dir = os.path.dirname(sys.argv[0])
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 'report back to the client as the user owning the ' 2083 'report back to the client as the user owning the '
2071 'token used for making the policy request.') 2084 'token used for making the policy request.')
2072 option_parser.add_option('', '--host', default='127.0.0.1', 2085 option_parser.add_option('', '--host', default='127.0.0.1',
2073 dest='host', 2086 dest='host',
2074 help='Hostname or IP upon which the server will ' 2087 help='Hostname or IP upon which the server will '
2075 'listen. Client connections will also only be ' 2088 'listen. Client connections will also only be '
2076 'allowed from this address.') 2089 'allowed from this address.')
2077 options, args = option_parser.parse_args() 2090 options, args = option_parser.parse_args()
2078 2091
2079 sys.exit(main(options, args)) 2092 sys.exit(main(options, args))
OLDNEW
« net/tools/testserver/chromiumsync.py ('K') | « net/tools/testserver/chromiumsync.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698