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

Side by Side Diff: net/tools/testserver/chromiumsync.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 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """An implementation of the server side of the Chromium sync protocol. 5 """An implementation of the server side of the Chromium sync protocol.
6 6
7 The details of the protocol are described mostly by comments in the protocol 7 The details of the protocol are described mostly by comments in the protocol
8 buffer definition at chrome/browser/sync/protocol/sync.proto. 8 buffer definition at chrome/browser/sync/protocol/sync.proto.
9 """ 9 """
10 10
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 nigori_tag = "google_chrome_nigori" 917 nigori_tag = "google_chrome_nigori"
918 nigori_original = self._entries.get(self._ServerTagToId(nigori_tag)) 918 nigori_original = self._entries.get(self._ServerTagToId(nigori_tag))
919 if (nigori_original.specifics.Extensions[nigori_specifics_pb2.nigori]. 919 if (nigori_original.specifics.Extensions[nigori_specifics_pb2.nigori].
920 sync_tabs): 920 sync_tabs):
921 return 921 return
922 nigori_new = copy.deepcopy(nigori_original) 922 nigori_new = copy.deepcopy(nigori_original)
923 nigori_new.specifics.Extensions[nigori_specifics_pb2.nigori].sync_tabs = ( 923 nigori_new.specifics.Extensions[nigori_specifics_pb2.nigori].sync_tabs = (
924 True) 924 True)
925 self._SaveEntry(nigori_new) 925 self._SaveEntry(nigori_new)
926 926
927 def TriggerCreateSyncedBookmarks(self):
tim (not reviewing) 2012/03/05 23:28:19 Could add a chromiumsync_test.py test for this?
Nicolas Zea 2012/03/06 20:42:32 Done.
928 """Create the Synced Bookmarks folder under the Bookmarks permanent item.
929
930 Clients will then received the Synced Bookmarks folder on future
931 GetUpdates, and new bookmarks can be added within the Synced Bookmarks
932 folder.
933 """
934
935 synced_bookmarks_spec = (
936 PermanentItem('synced_bookmarks', name='Synced Bookmarks',
937 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK))
938 self._PERMANENT_ITEM_SPECS.append(synced_bookmarks_spec)
939 self._CreatePermanentItem(synced_bookmarks_spec)
940
927 def SetInducedError(self, error, error_frequency, 941 def SetInducedError(self, error, error_frequency,
928 sync_count_before_errors): 942 sync_count_before_errors):
929 self.induced_error = error 943 self.induced_error = error
930 self.induced_error_frequency = error_frequency 944 self.induced_error_frequency = error_frequency
931 self.sync_count_before_errors = sync_count_before_errors 945 self.sync_count_before_errors = sync_count_before_errors
932 946
933 def GetInducedError(self): 947 def GetInducedError(self):
934 return self.induced_error 948 return self.induced_error
935 949
936 950
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 200, 1080 200,
1067 '<html><title>Transient error</title><H1>Transient error</H1></html>') 1081 '<html><title>Transient error</title><H1>Transient error</H1></html>')
1068 1082
1069 def HandleSetSyncTabs(self): 1083 def HandleSetSyncTabs(self):
1070 """Set the 'sync_tab' field of the nigori node for this account.""" 1084 """Set the 'sync_tab' field of the nigori node for this account."""
1071 self.account.TriggerSyncTabs() 1085 self.account.TriggerSyncTabs()
1072 return ( 1086 return (
1073 200, 1087 200,
1074 '<html><title>Sync Tabs</title><H1>Sync Tabs</H1></html>') 1088 '<html><title>Sync Tabs</title><H1>Sync Tabs</H1></html>')
1075 1089
1090 def HandleCreateSyncedBookmarks(self):
1091 """Create the Synced Bookmarks folder under Bookmarks."""
1092 self.account.TriggerCreateSyncedBookmarks()
1093 return (
1094 200,
1095 '<html><title>Synced Bookmarks</title><H1>Synced Bookmarks</H1></html>')
1096
1076 def HandleCommand(self, query, raw_request): 1097 def HandleCommand(self, query, raw_request):
1077 """Decode and handle a sync command from a raw input of bytes. 1098 """Decode and handle a sync command from a raw input of bytes.
1078 1099
1079 This is the main entry point for this class. It is safe to call this 1100 This is the main entry point for this class. It is safe to call this
1080 method from multiple threads. 1101 method from multiple threads.
1081 1102
1082 Args: 1103 Args:
1083 raw_request: An iterable byte sequence to be interpreted as a sync 1104 raw_request: An iterable byte sequence to be interpreted as a sync
1084 protocol command. 1105 protocol command.
1085 Returns: 1106 Returns:
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 1246
1226 update_sieve.CheckMigrationState() 1247 update_sieve.CheckMigrationState()
1227 1248
1228 new_timestamp, entries, remaining = self.account.GetChanges(update_sieve) 1249 new_timestamp, entries, remaining = self.account.GetChanges(update_sieve)
1229 1250
1230 update_response.changes_remaining = remaining 1251 update_response.changes_remaining = remaining
1231 for entry in entries: 1252 for entry in entries:
1232 reply = update_response.entries.add() 1253 reply = update_response.entries.add()
1233 reply.CopyFrom(entry) 1254 reply.CopyFrom(entry)
1234 update_sieve.SaveProgress(new_timestamp, update_response) 1255 update_sieve.SaveProgress(new_timestamp, update_response)
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc ('k') | net/tools/testserver/testserver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698