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

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

Issue 3107008: sync: Add sessions to protocol and chromiumsync python test server. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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
« no previous file with comments | « chrome/browser/sync/protocol/sync_proto.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python2.4 1 #!/usr/bin/python2.4
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 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 """An implementation of the server side of the Chromium sync protocol. 6 """An implementation of the server side of the Chromium sync protocol.
7 7
8 The details of the protocol are described mostly by comments in the protocol 8 The details of the protocol are described mostly by comments in the protocol
9 buffer definition at chrome/browser/sync/protocol/sync.proto. 9 buffer definition at chrome/browser/sync/protocol/sync.proto.
10 """ 10 """
11 11
12 import operator 12 import operator
13 import random 13 import random
14 import threading 14 import threading
15 15
16 import autofill_specifics_pb2 16 import autofill_specifics_pb2
17 import bookmark_specifics_pb2 17 import bookmark_specifics_pb2
18 import extension_specifics_pb2 18 import extension_specifics_pb2
19 import nigori_specifics_pb2 19 import nigori_specifics_pb2
20 import password_specifics_pb2 20 import password_specifics_pb2
21 import preference_specifics_pb2 21 import preference_specifics_pb2
22 import theme_specifics_pb2 22 import theme_specifics_pb2
23 import typed_url_specifics_pb2 23 import typed_url_specifics_pb2
24 import session_specifics_pb2
24 import sync_pb2 25 import sync_pb2
25 26
26 # An enumeration of the various kinds of data that can be synced. 27 # An enumeration of the various kinds of data that can be synced.
27 # Over the wire, this enumeration is not used: a sync object's type is 28 # Over the wire, this enumeration is not used: a sync object's type is
28 # inferred by which EntitySpecifics extension it has. But in the context 29 # inferred by which EntitySpecifics extension it has. But in the context
29 # of a program, it is useful to have an enumeration. 30 # of a program, it is useful to have an enumeration.
30 ALL_TYPES = ( 31 ALL_TYPES = (
31 TOP_LEVEL, # The type of the 'Google Chrome' folder. 32 TOP_LEVEL, # The type of the 'Google Chrome' folder.
32 AUTOFILL, 33 AUTOFILL,
33 BOOKMARK, 34 BOOKMARK,
34 EXTENSIONS, 35 EXTENSIONS,
35 NIGORI, 36 NIGORI,
36 PASSWORD, 37 PASSWORD,
37 PREFERENCE, 38 PREFERENCE,
38 # SESSION, 39 SESSION,
39 THEME, 40 THEME,
40 TYPED_URL) = range(9) 41 TYPED_URL) = range(10)
41 42
42 # Given a sync type from ALL_TYPES, find the extension token corresponding 43 # Given a sync type from ALL_TYPES, find the extension token corresponding
43 # to that datatype. Note that TOP_LEVEL has no such token. 44 # to that datatype. Note that TOP_LEVEL has no such token.
44 SYNC_TYPE_TO_EXTENSION = { 45 SYNC_TYPE_TO_EXTENSION = {
45 AUTOFILL: autofill_specifics_pb2.autofill, 46 AUTOFILL: autofill_specifics_pb2.autofill,
46 BOOKMARK: bookmark_specifics_pb2.bookmark, 47 BOOKMARK: bookmark_specifics_pb2.bookmark,
47 EXTENSIONS: extension_specifics_pb2.extension, 48 EXTENSIONS: extension_specifics_pb2.extension,
48 NIGORI: nigori_specifics_pb2.nigori, 49 NIGORI: nigori_specifics_pb2.nigori,
49 PASSWORD: password_specifics_pb2.password, 50 PASSWORD: password_specifics_pb2.password,
50 PREFERENCE: preference_specifics_pb2.preference, 51 PREFERENCE: preference_specifics_pb2.preference,
51 # SESSION: session_specifics_pb2.session, # Disabled 52 SESSION: session_specifics_pb2.session,
52 THEME: theme_specifics_pb2.theme, 53 THEME: theme_specifics_pb2.theme,
53 TYPED_URL: typed_url_specifics_pb2.typed_url, 54 TYPED_URL: typed_url_specifics_pb2.typed_url,
54 } 55 }
55 56
56 # The parent ID used to indicate a top-level node. 57 # The parent ID used to indicate a top-level node.
57 ROOT_ID = '0' 58 ROOT_ID = '0'
58 59
59 def GetEntryType(entry): 60 def GetEntryType(entry):
60 """Extract the sync type from a SyncEntry. 61 """Extract the sync type from a SyncEntry.
61 62
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 PermanentItem('other_bookmarks', name='Other Bookmarks', 160 PermanentItem('other_bookmarks', name='Other Bookmarks',
160 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK), 161 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK),
161 PermanentItem('google_chrome_preferences', name='Preferences', 162 PermanentItem('google_chrome_preferences', name='Preferences',
162 parent_tag='google_chrome', sync_type=PREFERENCE), 163 parent_tag='google_chrome', sync_type=PREFERENCE),
163 PermanentItem('google_chrome_autofill', name='Autofill', 164 PermanentItem('google_chrome_autofill', name='Autofill',
164 parent_tag='google_chrome', sync_type=AUTOFILL), 165 parent_tag='google_chrome', sync_type=AUTOFILL),
165 PermanentItem('google_chrome_extensions', name='Extensions', 166 PermanentItem('google_chrome_extensions', name='Extensions',
166 parent_tag='google_chrome', sync_type=EXTENSIONS), 167 parent_tag='google_chrome', sync_type=EXTENSIONS),
167 PermanentItem('google_chrome_passwords', name='Passwords', 168 PermanentItem('google_chrome_passwords', name='Passwords',
168 parent_tag='google_chrome', sync_type=PASSWORD), 169 parent_tag='google_chrome', sync_type=PASSWORD),
169 # TODO(rsimha): Disabled since the protocol does not support it yet. 170 PermanentItem('google_chrome_sessions', name='Sessions',
170 # PermanentItem('google_chrome_sessions', name='Sessions', 171 parent_tag='google_chrome', sync_type=SESSION),
171 # parent_tag='google_chrome', SESSION),
172 PermanentItem('google_chrome_themes', name='Themes', 172 PermanentItem('google_chrome_themes', name='Themes',
173 parent_tag='google_chrome', sync_type=THEME), 173 parent_tag='google_chrome', sync_type=THEME),
174 PermanentItem('google_chrome_typed_urls', name='Typed URLs', 174 PermanentItem('google_chrome_typed_urls', name='Typed URLs',
175 parent_tag='google_chrome', sync_type=TYPED_URL), 175 parent_tag='google_chrome', sync_type=TYPED_URL),
176 PermanentItem('google_chrome_nigori', name='Nigori', 176 PermanentItem('google_chrome_nigori', name='Nigori',
177 parent_tag='google_chrome', sync_type=NIGORI), 177 parent_tag='google_chrome', sync_type=NIGORI),
178 ] 178 ]
179 179
180 def __init__(self): 180 def __init__(self):
181 self._version = 0 181 self._version = 0
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 new_timestamp, entries = self.account.GetChangesFromTimestamp( 692 new_timestamp, entries = self.account.GetChangesFromTimestamp(
693 requested_types, update_request.from_timestamp) 693 requested_types, update_request.from_timestamp)
694 694
695 # If the client is up to date, we are careful not to set the 695 # If the client is up to date, we are careful not to set the
696 # new_timestamp field. 696 # new_timestamp field.
697 if new_timestamp != update_request.from_timestamp: 697 if new_timestamp != update_request.from_timestamp:
698 update_response.new_timestamp = new_timestamp 698 update_response.new_timestamp = new_timestamp
699 for e in entries: 699 for e in entries:
700 reply = update_response.entries.add() 700 reply = update_response.entries.add()
701 reply.CopyFrom(e) 701 reply.CopyFrom(e)
OLDNEW
« no previous file with comments | « chrome/browser/sync/protocol/sync_proto.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698