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

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

Issue 1110833002: [autofill] Sync server card and address metadata. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Work Created 5 years, 7 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
OLDNEW
1 # Copyright 2013 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
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 # of a program, it is useful to have an enumeration. 62 # of a program, it is useful to have an enumeration.
63 ALL_TYPES = ( 63 ALL_TYPES = (
64 TOP_LEVEL, # The type of the 'Google Chrome' folder. 64 TOP_LEVEL, # The type of the 'Google Chrome' folder.
65 APPS, 65 APPS,
66 APP_LIST, 66 APP_LIST,
67 APP_NOTIFICATION, 67 APP_NOTIFICATION,
68 APP_SETTINGS, 68 APP_SETTINGS,
69 ARTICLE, 69 ARTICLE,
70 AUTOFILL, 70 AUTOFILL,
71 AUTOFILL_PROFILE, 71 AUTOFILL_PROFILE,
72 AUTOFILL_WALLET_METADATA,
72 BOOKMARK, 73 BOOKMARK,
73 DEVICE_INFO, 74 DEVICE_INFO,
74 DICTIONARY, 75 DICTIONARY,
75 EXPERIMENTS, 76 EXPERIMENTS,
76 EXTENSIONS, 77 EXTENSIONS,
77 HISTORY_DELETE_DIRECTIVE, 78 HISTORY_DELETE_DIRECTIVE,
78 MANAGED_USER_SETTING, 79 MANAGED_USER_SETTING,
79 MANAGED_USER_SHARED_SETTING, 80 MANAGED_USER_SHARED_SETTING,
80 MANAGED_USER_WHITELIST, 81 MANAGED_USER_WHITELIST,
81 MANAGED_USER, 82 MANAGED_USER,
82 NIGORI, 83 NIGORI,
83 PASSWORD, 84 PASSWORD,
84 PREFERENCE, 85 PREFERENCE,
85 PRIORITY_PREFERENCE, 86 PRIORITY_PREFERENCE,
86 SEARCH_ENGINE, 87 SEARCH_ENGINE,
87 SESSION, 88 SESSION,
88 SYNCED_NOTIFICATION, 89 SYNCED_NOTIFICATION,
89 SYNCED_NOTIFICATION_APP_INFO, 90 SYNCED_NOTIFICATION_APP_INFO,
90 THEME, 91 THEME,
91 TYPED_URL, 92 TYPED_URL,
92 EXTENSION_SETTINGS, 93 EXTENSION_SETTINGS,
93 FAVICON_IMAGES, 94 FAVICON_IMAGES,
94 FAVICON_TRACKING, 95 FAVICON_TRACKING,
95 WIFI_CREDENTIAL) = range(32) 96 WIFI_CREDENTIAL) = range(33)
96 97
97 # An enumeration on the frequency at which the server should send errors 98 # An enumeration on the frequency at which the server should send errors
98 # to the client. This would be specified by the url that triggers the error. 99 # to the client. This would be specified by the url that triggers the error.
99 # Note: This enum should be kept in the same order as the enum in sync_test.h. 100 # Note: This enum should be kept in the same order as the enum in sync_test.h.
100 SYNC_ERROR_FREQUENCY = ( 101 SYNC_ERROR_FREQUENCY = (
101 ERROR_FREQUENCY_NONE, 102 ERROR_FREQUENCY_NONE,
102 ERROR_FREQUENCY_ALWAYS, 103 ERROR_FREQUENCY_ALWAYS,
103 ERROR_FREQUENCY_TWO_THIRDS) = range(3) 104 ERROR_FREQUENCY_TWO_THIRDS) = range(3)
104 105
105 # Well-known server tag of the top level 'Google Chrome' folder. 106 # Well-known server tag of the top level 'Google Chrome' folder.
106 TOP_LEVEL_FOLDER_TAG = 'google_chrome' 107 TOP_LEVEL_FOLDER_TAG = 'google_chrome'
107 108
108 # Given a sync type from ALL_TYPES, find the FieldDescriptor corresponding 109 # Given a sync type from ALL_TYPES, find the FieldDescriptor corresponding
109 # to that datatype. Note that TOP_LEVEL has no such token. 110 # to that datatype. Note that TOP_LEVEL has no such token.
110 SYNC_TYPE_FIELDS = sync_pb2.EntitySpecifics.DESCRIPTOR.fields_by_name 111 SYNC_TYPE_FIELDS = sync_pb2.EntitySpecifics.DESCRIPTOR.fields_by_name
111 SYNC_TYPE_TO_DESCRIPTOR = { 112 SYNC_TYPE_TO_DESCRIPTOR = {
112 APP_LIST: SYNC_TYPE_FIELDS['app_list'], 113 APP_LIST: SYNC_TYPE_FIELDS['app_list'],
113 APP_NOTIFICATION: SYNC_TYPE_FIELDS['app_notification'], 114 APP_NOTIFICATION: SYNC_TYPE_FIELDS['app_notification'],
114 APP_SETTINGS: SYNC_TYPE_FIELDS['app_setting'], 115 APP_SETTINGS: SYNC_TYPE_FIELDS['app_setting'],
115 APPS: SYNC_TYPE_FIELDS['app'], 116 APPS: SYNC_TYPE_FIELDS['app'],
116 ARTICLE: SYNC_TYPE_FIELDS['article'], 117 ARTICLE: SYNC_TYPE_FIELDS['article'],
117 AUTOFILL: SYNC_TYPE_FIELDS['autofill'], 118 AUTOFILL: SYNC_TYPE_FIELDS['autofill'],
118 AUTOFILL_PROFILE: SYNC_TYPE_FIELDS['autofill_profile'], 119 AUTOFILL_PROFILE: SYNC_TYPE_FIELDS['autofill_profile'],
120 AUTOFILL_WALLET_METADATA: SYNC_TYPE_FIELDS['wallet_metadata'],
119 BOOKMARK: SYNC_TYPE_FIELDS['bookmark'], 121 BOOKMARK: SYNC_TYPE_FIELDS['bookmark'],
120 DEVICE_INFO: SYNC_TYPE_FIELDS['device_info'], 122 DEVICE_INFO: SYNC_TYPE_FIELDS['device_info'],
121 DICTIONARY: SYNC_TYPE_FIELDS['dictionary'], 123 DICTIONARY: SYNC_TYPE_FIELDS['dictionary'],
122 EXPERIMENTS: SYNC_TYPE_FIELDS['experiments'], 124 EXPERIMENTS: SYNC_TYPE_FIELDS['experiments'],
123 EXTENSION_SETTINGS: SYNC_TYPE_FIELDS['extension_setting'], 125 EXTENSION_SETTINGS: SYNC_TYPE_FIELDS['extension_setting'],
124 EXTENSIONS: SYNC_TYPE_FIELDS['extension'], 126 EXTENSIONS: SYNC_TYPE_FIELDS['extension'],
125 FAVICON_IMAGES: SYNC_TYPE_FIELDS['favicon_image'], 127 FAVICON_IMAGES: SYNC_TYPE_FIELDS['favicon_image'],
126 FAVICON_TRACKING: SYNC_TYPE_FIELDS['favicon_tracking'], 128 FAVICON_TRACKING: SYNC_TYPE_FIELDS['favicon_tracking'],
127 HISTORY_DELETE_DIRECTIVE: SYNC_TYPE_FIELDS['history_delete_directive'], 129 HISTORY_DELETE_DIRECTIVE: SYNC_TYPE_FIELDS['history_delete_directive'],
128 MANAGED_USER_SHARED_SETTING: 130 MANAGED_USER_SHARED_SETTING:
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK), 506 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK),
505 PermanentItem('other_bookmarks', name='Other Bookmarks', 507 PermanentItem('other_bookmarks', name='Other Bookmarks',
506 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK), 508 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK),
507 PermanentItem('synced_bookmarks', name='Synced Bookmarks', 509 PermanentItem('synced_bookmarks', name='Synced Bookmarks',
508 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK, 510 parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK,
509 create_by_default=False), 511 create_by_default=False),
510 PermanentItem('google_chrome_autofill', name='Autofill', 512 PermanentItem('google_chrome_autofill', name='Autofill',
511 parent_tag=ROOT_ID, sync_type=AUTOFILL), 513 parent_tag=ROOT_ID, sync_type=AUTOFILL),
512 PermanentItem('google_chrome_autofill_profiles', name='Autofill Profiles', 514 PermanentItem('google_chrome_autofill_profiles', name='Autofill Profiles',
513 parent_tag=ROOT_ID, sync_type=AUTOFILL_PROFILE), 515 parent_tag=ROOT_ID, sync_type=AUTOFILL_PROFILE),
516 PermanentItem('google_chrome_autofill_wallet_metadata',
517 name='Autofill Wallet Metadata', parent_tag=ROOT_ID,
518 sync_type=AUTOFILL_WALLET_METADATA),
514 PermanentItem('google_chrome_device_info', name='Device Info', 519 PermanentItem('google_chrome_device_info', name='Device Info',
515 parent_tag=ROOT_ID, sync_type=DEVICE_INFO), 520 parent_tag=ROOT_ID, sync_type=DEVICE_INFO),
516 PermanentItem('google_chrome_experiments', name='Experiments', 521 PermanentItem('google_chrome_experiments', name='Experiments',
517 parent_tag=ROOT_ID, sync_type=EXPERIMENTS), 522 parent_tag=ROOT_ID, sync_type=EXPERIMENTS),
518 PermanentItem('google_chrome_extension_settings', 523 PermanentItem('google_chrome_extension_settings',
519 name='Extension Settings', 524 name='Extension Settings',
520 parent_tag=ROOT_ID, sync_type=EXTENSION_SETTINGS), 525 parent_tag=ROOT_ID, sync_type=EXTENSION_SETTINGS),
521 PermanentItem('google_chrome_extensions', name='Extensions', 526 PermanentItem('google_chrome_extensions', name='Extensions',
522 parent_tag=ROOT_ID, sync_type=EXTENSIONS), 527 parent_tag=ROOT_ID, sync_type=EXTENSIONS),
523 PermanentItem('google_chrome_history_delete_directives', 528 PermanentItem('google_chrome_history_delete_directives',
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 1622
1618 Args: 1623 Args:
1619 sessions_commit_delay_seconds: The desired sync delay time for sessions. 1624 sessions_commit_delay_seconds: The desired sync delay time for sessions.
1620 """ 1625 """
1621 if not self._client_command: 1626 if not self._client_command:
1622 self._client_command = client_commands_pb2.ClientCommand() 1627 self._client_command = client_commands_pb2.ClientCommand()
1623 1628
1624 self._client_command.sessions_commit_delay_seconds = \ 1629 self._client_command.sessions_commit_delay_seconds = \
1625 sessions_commit_delay_seconds 1630 sessions_commit_delay_seconds
1626 return self._client_command 1631 return self._client_command
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698