summaryrefslogtreecommitdiffstats
path: root/net/tools
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-25 22:21:02 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-25 22:21:02 +0000
commit23caf1d46883d01d754785cc9e77f121f73c2eab (patch)
tree3a6fe544e2c3120f0d70ab86d91e48fd425cff71 /net/tools
parent664d15589d09e7dc566b698bf6deb4868c7bda5e (diff)
downloadchromium_src-23caf1d46883d01d754785cc9e77f121f73c2eab.zip
chromium_src-23caf1d46883d01d754785cc9e77f121f73c2eab.tar.gz
chromium_src-23caf1d46883d01d754785cc9e77f121f73c2eab.tar.bz2
[Sync] Add support for enabling session sync remotely.
A "sync_tabs" field has been added to the nigori node. When this field is set, and if the user has elected to keep everything synced, we automatically enable session sync for them. This is done by way of the migrator and does not require a restart of sync or user intervention. BUG=none TEST=sync_integration_tests --gtest_filter="*SetSyncTabs*" Review URL: http://codereview.chromium.org/7669073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98328 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rwxr-xr-xnet/tools/testserver/chromiumsync.py24
-rwxr-xr-xnet/tools/testserver/testserver.py15
2 files changed, 38 insertions, 1 deletions
diff --git a/net/tools/testserver/chromiumsync.py b/net/tools/testserver/chromiumsync.py
index cc71d47b..166dff1 100755
--- a/net/tools/testserver/chromiumsync.py
+++ b/net/tools/testserver/chromiumsync.py
@@ -863,6 +863,23 @@ class SyncDataModel(object):
entry.parent_id_string)
self._entries[entry.id_string] = entry
+ def TriggerSyncTabs(self):
+ """Set the 'sync_tabs' field to this account's nigori node.
+
+ If the field is not currently set, will write a new nigori node entry
+ with the field set. Else does nothing.
+ """
+
+ nigori_tag = "google_chrome_nigori"
+ nigori_original = self._entries.get(self._ServerTagToId(nigori_tag))
+ if (nigori_original.specifics.Extensions[nigori_specifics_pb2.nigori].
+ sync_tabs):
+ return
+ nigori_new = copy.deepcopy(nigori_original)
+ nigori_new.specifics.Extensions[nigori_specifics_pb2.nigori].sync_tabs = (
+ True)
+ self._SaveEntry(nigori_new)
+
class TestServer(object):
"""An object to handle requests for one (and only one) Chrome Sync account.
@@ -939,6 +956,13 @@ class TestServer(object):
200,
'<html><title>Transient error</title><H1>Transient error</H1></html>')
+ def HandleSetSyncTabs(self):
+ """Set the 'sync_tab' field of the nigori node for this account."""
+ self.account.TriggerSyncTabs()
+ return (
+ 200,
+ '<html><title>Sync Tabs</title><H1>Sync Tabs</H1></html>')
+
def HandleCommand(self, query, raw_request):
"""Decode and handle a sync command from a raw input of bytes.
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index c079b4c5..5d27dbe 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -1407,7 +1407,8 @@ class SyncPageHandler(BasePageHandler):
get_handlers = [self.ChromiumSyncMigrationOpHandler,
self.ChromiumSyncTimeHandler,
self.ChromiumSyncBirthdayErrorOpHandler,
- self.ChromiumSyncTransientErrorOpHandler]
+ self.ChromiumSyncTransientErrorOpHandler,
+ self.ChromiumSyncSyncTabsOpHandler]
post_handlers = [self.ChromiumSyncCommandHandler,
self.ChromiumSyncTimeHandler]
@@ -1495,6 +1496,18 @@ class SyncPageHandler(BasePageHandler):
self.wfile.write(raw_reply)
return True;
+ def ChromiumSyncSyncTabsOpHandler(self):
+ test_name = "/chromiumsync/synctabs"
+ if not self._ShouldHandleRequest(test_name):
+ return False
+ result, raw_reply = self.server._sync_handler.HandleSetSyncTabs()
+ self.send_response(result)
+ self.send_header('Content-Type', 'text/html')
+ self.send_header('Content-Length', len(raw_reply))
+ self.end_headers()
+ self.wfile.write(raw_reply)
+ return True;
+
def MakeDataDir():
if options.data_dir: