diff options
Diffstat (limited to 'net/tools')
-rw-r--r-- | net/tools/testserver/chromiumsync.py | 56 | ||||
-rwxr-xr-x | net/tools/testserver/chromiumsync_test.py | 14 |
2 files changed, 37 insertions, 33 deletions
diff --git a/net/tools/testserver/chromiumsync.py b/net/tools/testserver/chromiumsync.py index 62156b2..92542e3 100644 --- a/net/tools/testserver/chromiumsync.py +++ b/net/tools/testserver/chromiumsync.py @@ -50,6 +50,8 @@ ALL_TYPES = ( AUTOFILL, AUTOFILL_PROFILE, BOOKMARK, + DEVICE_INFO, + EXPERIMENTS, EXTENSIONS, HISTORY_DELETE_DIRECTIVE, NIGORI, @@ -59,7 +61,7 @@ ALL_TYPES = ( SESSION, THEME, TYPED_URL, - EXTENSION_SETTINGS) = range(17) + EXTENSION_SETTINGS) = range(19) # An eumeration on the frequency at which the server should send errors # to the client. This would be specified by the url that triggers the error. @@ -82,6 +84,8 @@ SYNC_TYPE_TO_DESCRIPTOR = { AUTOFILL: SYNC_TYPE_FIELDS['autofill'], AUTOFILL_PROFILE: SYNC_TYPE_FIELDS['autofill_profile'], BOOKMARK: SYNC_TYPE_FIELDS['bookmark'], + DEVICE_INFO: SYNC_TYPE_FIELDS['device_info'], + EXPERIMENTS: SYNC_TYPE_FIELDS['experiments'], EXTENSION_SETTINGS: SYNC_TYPE_FIELDS['extension_setting'], EXTENSIONS: SYNC_TYPE_FIELDS['extension'], HISTORY_DELETE_DIRECTIVE: SYNC_TYPE_FIELDS['history_delete_directive'], @@ -415,10 +419,15 @@ class SyncDataModel(object): # Specify all the permanent items that a model might need. _PERMANENT_ITEM_SPECS = [ - PermanentItem('google_chrome', name='Google Chrome', - parent_tag=ROOT_ID, sync_type=TOP_LEVEL), + PermanentItem('google_chrome_apps', name='Apps', + parent_tag=ROOT_ID, sync_type=APPS), + PermanentItem('google_chrome_app_notifications', name='App Notifications', + parent_tag=ROOT_ID, sync_type=APP_NOTIFICATION), + PermanentItem('google_chrome_app_settings', + name='App Settings', + parent_tag=ROOT_ID, sync_type=APP_SETTINGS), PermanentItem('google_chrome_bookmarks', name='Bookmarks', - parent_tag='google_chrome', sync_type=BOOKMARK), + parent_tag=ROOT_ID, sync_type=BOOKMARK), PermanentItem('bookmark_bar', name='Bookmark Bar', parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK), PermanentItem('synced_bookmarks', name='Mobile Bookmarks', @@ -428,40 +437,37 @@ class SyncDataModel(object): PermanentItem('synced_bookmarks', name='Synced Bookmarks', parent_tag='google_chrome_bookmarks', sync_type=BOOKMARK, create_by_default=False), - PermanentItem('google_chrome_preferences', name='Preferences', - parent_tag='google_chrome', sync_type=PREFERENCE), PermanentItem('google_chrome_autofill', name='Autofill', - parent_tag='google_chrome', sync_type=AUTOFILL), + parent_tag=ROOT_ID, sync_type=AUTOFILL), PermanentItem('google_chrome_autofill_profiles', name='Autofill Profiles', - parent_tag='google_chrome', sync_type=AUTOFILL_PROFILE), - PermanentItem('google_chrome_app_settings', - name='App Settings', - parent_tag='google_chrome', sync_type=APP_SETTINGS), + parent_tag=ROOT_ID, sync_type=AUTOFILL_PROFILE), + PermanentItem('google_chrome_device_info', name='Device Info', + parent_tag=ROOT_ID, sync_type=DEVICE_INFO), + PermanentItem('google_chrome_experiments', name='Experiments', + parent_tag=ROOT_ID, sync_type=EXPERIMENTS), PermanentItem('google_chrome_extension_settings', name='Extension Settings', - parent_tag='google_chrome', sync_type=EXTENSION_SETTINGS), + parent_tag=ROOT_ID, sync_type=EXTENSION_SETTINGS), PermanentItem('google_chrome_extensions', name='Extensions', - parent_tag='google_chrome', sync_type=EXTENSIONS), + parent_tag=ROOT_ID, sync_type=EXTENSIONS), PermanentItem('google_chrome_history_delete_directives', name='History Delete Directives', - parent_tag='google_chrome', + parent_tag=ROOT_ID, sync_type=HISTORY_DELETE_DIRECTIVE), + PermanentItem('google_chrome_nigori', name='Nigori', + parent_tag=ROOT_ID, sync_type=NIGORI), PermanentItem('google_chrome_passwords', name='Passwords', - parent_tag='google_chrome', sync_type=PASSWORD), + parent_tag=ROOT_ID, sync_type=PASSWORD), + PermanentItem('google_chrome_preferences', name='Preferences', + parent_tag=ROOT_ID, sync_type=PREFERENCE), PermanentItem('google_chrome_search_engines', name='Search Engines', - parent_tag='google_chrome', sync_type=SEARCH_ENGINE), + parent_tag=ROOT_ID, sync_type=SEARCH_ENGINE), PermanentItem('google_chrome_sessions', name='Sessions', - parent_tag='google_chrome', sync_type=SESSION), + parent_tag=ROOT_ID, sync_type=SESSION), PermanentItem('google_chrome_themes', name='Themes', - parent_tag='google_chrome', sync_type=THEME), + parent_tag=ROOT_ID, sync_type=THEME), PermanentItem('google_chrome_typed_urls', name='Typed URLs', - parent_tag='google_chrome', sync_type=TYPED_URL), - PermanentItem('google_chrome_nigori', name='Nigori', - parent_tag='google_chrome', sync_type=NIGORI), - PermanentItem('google_chrome_apps', name='Apps', - parent_tag='google_chrome', sync_type=APPS), - PermanentItem('google_chrome_app_notifications', name='App Notifications', - parent_tag='google_chrome', sync_type=APP_NOTIFICATION), + parent_tag=ROOT_ID, sync_type=TYPED_URL), ] def __init__(self): diff --git a/net/tools/testserver/chromiumsync_test.py b/net/tools/testserver/chromiumsync_test.py index e680d41..7a68b40 100755 --- a/net/tools/testserver/chromiumsync_test.py +++ b/net/tools/testserver/chromiumsync_test.py @@ -50,7 +50,8 @@ class SyncDataModelTest(unittest.TestCase): declared_specs.add(spec.tag) unique_datatypes = set([x.sync_type for x in specs]) - self.assertEqual(unique_datatypes, set(chromiumsync.ALL_TYPES), + self.assertEqual(unique_datatypes, + set(chromiumsync.ALL_TYPES[1:]), 'Every sync datatype should have a permanent folder ' 'associated with it') @@ -70,19 +71,17 @@ class SyncDataModelTest(unittest.TestCase): def testCreatePermanentItems(self): self.model._CreateDefaultPermanentItems(chromiumsync.ALL_TYPES) - self.assertEqual(len(chromiumsync.ALL_TYPES) + 2, + self.assertEqual(len(chromiumsync.ALL_TYPES) + 1, len(self.model._entries)) def ExpectedPermanentItemCount(self, sync_type): if sync_type == chromiumsync.BOOKMARK: if self._expect_synced_bookmarks_folder: - return 5 - else: return 4 - elif sync_type == chromiumsync.TOP_LEVEL: - return 1 + else: + return 3 else: - return 2 + return 1 def testGetChangesFromTimestampZeroForEachType(self): all_types = chromiumsync.ALL_TYPES[1:] @@ -96,7 +95,6 @@ class SyncDataModelTest(unittest.TestCase): expected_count = self.ExpectedPermanentItemCount(sync_type) self.assertEqual(expected_count, version) self.assertEqual(expected_count, len(changes)) - self.assertEqual('google_chrome', changes[0].server_defined_unique_tag) for change in changes: self.assertTrue(change.HasField('server_defined_unique_tag')) self.assertEqual(change.version, change.sync_timestamp) |