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

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

Issue 11971025: [sync] Divorce python sync test server chromiumsync.py from testserver.py (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 11 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 | « sync/tools/testserver/OWNERS ('k') | sync/tools/testserver/chromiumsync_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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
11 import cgi 11 import cgi
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 parent_tag=ROOT_ID, sync_type=APPS), 435 parent_tag=ROOT_ID, sync_type=APPS),
436 PermanentItem('google_chrome_app_notifications', name='App Notifications', 436 PermanentItem('google_chrome_app_notifications', name='App Notifications',
437 parent_tag=ROOT_ID, sync_type=APP_NOTIFICATION), 437 parent_tag=ROOT_ID, sync_type=APP_NOTIFICATION),
438 PermanentItem('google_chrome_app_settings', 438 PermanentItem('google_chrome_app_settings',
439 name='App Settings', 439 name='App Settings',
440 parent_tag=ROOT_ID, sync_type=APP_SETTINGS), 440 parent_tag=ROOT_ID, sync_type=APP_SETTINGS),
441 PermanentItem('google_chrome_bookmarks', name='Bookmarks', 441 PermanentItem('google_chrome_bookmarks', name='Bookmarks',
442 parent_tag=ROOT_ID, sync_type=BOOKMARK), 442 parent_tag=ROOT_ID, sync_type=BOOKMARK),
443 PermanentItem('bookmark_bar', name='Bookmark Bar', 443 PermanentItem('bookmark_bar', name='Bookmark Bar',
444 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK), 444 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK),
445 PermanentItem('synced_bookmarks', name='Mobile Bookmarks',
446 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK),
447 PermanentItem('other_bookmarks', name='Other Bookmarks', 445 PermanentItem('other_bookmarks', name='Other Bookmarks',
448 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK), 446 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK),
449 PermanentItem('synced_bookmarks', name='Synced Bookmarks', 447 PermanentItem('synced_bookmarks', name='Synced Bookmarks',
450 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK, 448 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK,
451 create_by_default=False), 449 create_by_default=False), # Must be True in the iOS tree.
452 PermanentItem('google_chrome_autofill', name='Autofill', 450 PermanentItem('google_chrome_autofill', name='Autofill',
453 parent_tag=ROOT_ID, sync_type=AUTOFILL), 451 parent_tag=ROOT_ID, sync_type=AUTOFILL),
454 PermanentItem('google_chrome_autofill_profiles', name='Autofill Profiles', 452 PermanentItem('google_chrome_autofill_profiles', name='Autofill Profiles',
455 parent_tag=ROOT_ID, sync_type=AUTOFILL_PROFILE), 453 parent_tag=ROOT_ID, sync_type=AUTOFILL_PROFILE),
456 PermanentItem('google_chrome_device_info', name='Device Info', 454 PermanentItem('google_chrome_device_info', name='Device Info',
457 parent_tag=ROOT_ID, sync_type=DEVICE_INFO), 455 parent_tag=ROOT_ID, sync_type=DEVICE_INFO),
458 PermanentItem('google_chrome_experiments', name='Experiments', 456 PermanentItem('google_chrome_experiments', name='Experiments',
459 parent_tag=ROOT_ID, sync_type=EXPERIMENTS), 457 parent_tag=ROOT_ID, sync_type=EXPERIMENTS),
460 PermanentItem('google_chrome_extension_settings', 458 PermanentItem('google_chrome_extension_settings',
461 name='Extension Settings', 459 name='Extension Settings',
462 parent_tag=ROOT_ID, sync_type=EXTENSION_SETTINGS), 460 parent_tag=ROOT_ID, sync_type=EXTENSION_SETTINGS),
463 PermanentItem('google_chrome_extensions', name='Extensions', 461 PermanentItem('google_chrome_extensions', name='Extensions',
464 parent_tag=ROOT_ID, sync_type=EXTENSIONS), 462 parent_tag=ROOT_ID, sync_type=EXTENSIONS),
465 PermanentItem('google_chrome_history_delete_directives', 463 PermanentItem('google_chrome_history_delete_directives',
466 name='History Delete Directives', 464 name='History Delete Directives',
467 parent_tag=ROOT_ID, 465 parent_tag=ROOT_ID,
468 sync_type=HISTORY_DELETE_DIRECTIVE), 466 sync_type=HISTORY_DELETE_DIRECTIVE),
469 PermanentItem('google_chrome_nigori', name='Nigori', 467 PermanentItem('google_chrome_nigori', name='Nigori',
470 parent_tag=ROOT_ID, sync_type=NIGORI), 468 parent_tag=ROOT_ID, sync_type=NIGORI),
471 PermanentItem('google_chrome_passwords', name='Passwords', 469 PermanentItem('google_chrome_passwords', name='Passwords',
472 parent_tag=ROOT_ID, sync_type=PASSWORD), 470 parent_tag=ROOT_ID, sync_type=PASSWORD),
473 PermanentItem('google_chrome_preferences', name='Preferences', 471 PermanentItem('google_chrome_preferences', name='Preferences',
474 parent_tag=ROOT_ID, sync_type=PREFERENCE), 472 parent_tag=ROOT_ID, sync_type=PREFERENCE),
475 PermanentItem('google_chrome_preferences', name='Synced Notifications', 473 PermanentItem('google_chrome_synced_notifications',
474 name='Synced Notifications',
476 parent_tag=ROOT_ID, sync_type=SYNCED_NOTIFICATION), 475 parent_tag=ROOT_ID, sync_type=SYNCED_NOTIFICATION),
477 PermanentItem('google_chrome_search_engines', name='Search Engines', 476 PermanentItem('google_chrome_search_engines', name='Search Engines',
478 parent_tag=ROOT_ID, sync_type=SEARCH_ENGINE), 477 parent_tag=ROOT_ID, sync_type=SEARCH_ENGINE),
479 PermanentItem('google_chrome_sessions', name='Sessions', 478 PermanentItem('google_chrome_sessions', name='Sessions',
480 parent_tag=ROOT_ID, sync_type=SESSION), 479 parent_tag=ROOT_ID, sync_type=SESSION),
481 PermanentItem('google_chrome_themes', name='Themes', 480 PermanentItem('google_chrome_themes', name='Themes',
482 parent_tag=ROOT_ID, sync_type=THEME), 481 parent_tag=ROOT_ID, sync_type=THEME),
483 PermanentItem('google_chrome_typed_urls', name='Typed URLs', 482 PermanentItem('google_chrome_typed_urls', name='Typed URLs',
484 parent_tag=ROOT_ID, sync_type=TYPED_URL), 483 parent_tag=ROOT_ID, sync_type=TYPED_URL),
485 ] 484 ]
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 1039
1041 def GetInducedError(self): 1040 def GetInducedError(self):
1042 return self.induced_error 1041 return self.induced_error
1043 1042
1044 1043
1045 class TestServer(object): 1044 class TestServer(object):
1046 """An object to handle requests for one (and only one) Chrome Sync account. 1045 """An object to handle requests for one (and only one) Chrome Sync account.
1047 1046
1048 TestServer consumes the sync command messages that are the outermost 1047 TestServer consumes the sync command messages that are the outermost
1049 layers of the protocol, performs the corresponding actions on its 1048 layers of the protocol, performs the corresponding actions on its
1050 SyncDataModel, and constructs an appropropriate response message. 1049 SyncDataModel, and constructs an appropriate response message.
1051 """ 1050 """
1052 1051
1053 def __init__(self): 1052 def __init__(self):
1054 # The implementation supports exactly one account; its state is here. 1053 # The implementation supports exactly one account; its state is here.
1055 self.account = SyncDataModel() 1054 self.account = SyncDataModel()
1056 self.account_lock = threading.Lock() 1055 self.account_lock = threading.Lock()
1057 # Clients that have talked to us: a map from the full client ID 1056 # Clients that have talked to us: a map from the full client ID
1058 # to its nickname. 1057 # to its nickname.
1059 self.clients = {} 1058 self.clients = {}
1060 self.client_name_generator = ('+' * times + chr(c) 1059 self.client_name_generator = ('+' * times + chr(c)
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 sending_nigori_node = False 1361 sending_nigori_node = False
1363 for entry in entries: 1362 for entry in entries:
1364 if entry.name == 'Nigori': 1363 if entry.name == 'Nigori':
1365 sending_nigori_node = True 1364 sending_nigori_node = True
1366 reply = update_response.entries.add() 1365 reply = update_response.entries.add()
1367 reply.CopyFrom(entry) 1366 reply.CopyFrom(entry)
1368 update_sieve.SaveProgress(new_timestamp, update_response) 1367 update_sieve.SaveProgress(new_timestamp, update_response)
1369 1368
1370 if update_request.need_encryption_key or sending_nigori_node: 1369 if update_request.need_encryption_key or sending_nigori_node:
1371 update_response.encryption_keys.extend(self.account.GetKeystoreKeys()) 1370 update_response.encryption_keys.extend(self.account.GetKeystoreKeys())
OLDNEW
« no previous file with comments | « sync/tools/testserver/OWNERS ('k') | sync/tools/testserver/chromiumsync_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698