Simple offline startup integration test.
This is a simple offline startup integration test. This change also includes the groundwork for more complex offline startup test cases, including the ability to enable and disable network connectivity as well as configure the mock sync server with a username.
BUG=47918
Review URL: http://codereview.chromium.org/3078031
git-svn-id: http://src.chromium.org/svn/trunk/src/net/tools/testserver@56087 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
diff --git a/testserver.py b/testserver.py
index 0ad5d28..849ec17 100644
--- a/testserver.py
+++ b/testserver.py
@@ -127,6 +127,7 @@
self.WriteFile,
self.EchoTitleHandler,
self.EchoAllHandler,
+ self.ChromiumSyncConfigureHandler,
self.ChromiumSyncCommandHandler,
self.EchoHandler] + self._get_handlers
self._put_handlers = [
@@ -1007,6 +1008,29 @@
self.end_headers()
return True
+ def ChromiumSyncConfigureHandler(self):
+ """Handle updating the configuration of the sync server.
+
+ The name and value pairs of the post payload will update the
+ configuration of the sync server. Supported tuples are:
+ user_email,<email address> - Sets the email for the fake user account
+ """
+ test_name = "/chromiumsync/configure"
+ if not self._ShouldHandleRequest(test_name):
+ return False
+
+ length = int(self.headers.getheader('content-length'))
+ raw_request = self.rfile.read(length)
+ config = cgi.parse_qs(raw_request, keep_blank_values=1)
+
+ success = self._sync_handler.HandleConfigure(config)
+ if success:
+ self.send_response(200)
+ else:
+ self.send_response(500)
+ self.end_headers()
+ return True
+
def ChromiumSyncCommandHandler(self):
"""Handle a chromiumsync command arriving via http.