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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_registrar_unittest.cc

Issue 17552014: [Sync] Have SBH tell SyncManager which types to purge (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix dchecks Created 7 years, 6 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 #include "chrome/browser/sync/glue/sync_backend_registrar.h" 5 #include "chrome/browser/sync/glue/sync_backend_registrar.h"
6 6
7 #include "chrome/browser/sync/glue/change_processor_mock.h" 7 #include "chrome/browser/sync/glue/change_processor_mock.h"
8 #include "chrome/browser/sync/glue/ui_model_worker.h" 8 #include "chrome/browser/sync/glue/ui_model_worker.h"
9 #include "chrome/test/base/testing_profile.h" 9 #include "chrome/test/base/testing_profile.h"
10 #include "content/public/test/test_browser_thread.h" 10 #include "content/public/test/test_browser_thread.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 EXPECT_TRUE( 121 EXPECT_TRUE(
122 registrar.ConfigureDataTypes(types1, ModelTypeSet()).Equals(types1)); 122 registrar.ConfigureDataTypes(types1, ModelTypeSet()).Equals(types1));
123 { 123 {
124 syncer::ModelSafeRoutingInfo expected_routing_info; 124 syncer::ModelSafeRoutingInfo expected_routing_info;
125 expected_routing_info[BOOKMARKS] = syncer::GROUP_PASSIVE; 125 expected_routing_info[BOOKMARKS] = syncer::GROUP_PASSIVE;
126 expected_routing_info[NIGORI] = syncer::GROUP_PASSIVE; 126 expected_routing_info[NIGORI] = syncer::GROUP_PASSIVE;
127 expected_routing_info[AUTOFILL] = syncer::GROUP_PASSIVE; 127 expected_routing_info[AUTOFILL] = syncer::GROUP_PASSIVE;
128 ExpectRoutingInfo(&registrar, expected_routing_info); 128 ExpectRoutingInfo(&registrar, expected_routing_info);
129 } 129 }
130 ExpectHasProcessorsForTypes(registrar, ModelTypeSet()); 130 ExpectHasProcessorsForTypes(registrar, ModelTypeSet());
131 EXPECT_TRUE(types1.Equals(registrar.GetLastConfiguredTypes()));
131 132
132 // Add and remove. 133 // Add and remove.
133 const ModelTypeSet types2(PREFERENCES, THEMES); 134 const ModelTypeSet types2(PREFERENCES, THEMES);
134 EXPECT_TRUE(registrar.ConfigureDataTypes(types2, types1).Equals(types2)); 135 EXPECT_TRUE(registrar.ConfigureDataTypes(types2, types1).Equals(types2));
135 { 136 {
136 syncer::ModelSafeRoutingInfo expected_routing_info; 137 syncer::ModelSafeRoutingInfo expected_routing_info;
137 expected_routing_info[PREFERENCES] = syncer::GROUP_PASSIVE; 138 expected_routing_info[PREFERENCES] = syncer::GROUP_PASSIVE;
138 expected_routing_info[THEMES] = syncer::GROUP_PASSIVE; 139 expected_routing_info[THEMES] = syncer::GROUP_PASSIVE;
139 ExpectRoutingInfo(&registrar, expected_routing_info); 140 ExpectRoutingInfo(&registrar, expected_routing_info);
140 } 141 }
141 ExpectHasProcessorsForTypes(registrar, ModelTypeSet()); 142 ExpectHasProcessorsForTypes(registrar, ModelTypeSet());
143 EXPECT_TRUE(types2.Equals(registrar.GetLastConfiguredTypes()));
142 144
143 // Remove. 145 // Remove.
144 EXPECT_TRUE(registrar.ConfigureDataTypes(ModelTypeSet(), types2).Empty()); 146 EXPECT_TRUE(registrar.ConfigureDataTypes(ModelTypeSet(), types2).Empty());
145 ExpectRoutingInfo(&registrar, syncer::ModelSafeRoutingInfo()); 147 ExpectRoutingInfo(&registrar, syncer::ModelSafeRoutingInfo());
146 ExpectHasProcessorsForTypes(registrar, ModelTypeSet()); 148 ExpectHasProcessorsForTypes(registrar, ModelTypeSet());
149 EXPECT_TRUE(ModelTypeSet().Equals(registrar.GetLastConfiguredTypes()));
147 150
148 registrar.OnSyncerShutdownComplete(); 151 registrar.OnSyncerShutdownComplete();
149 registrar.StopOnUIThread(); 152 registrar.StopOnUIThread();
150 } 153 }
151 154
152 void TriggerChanges(SyncBackendRegistrar* registrar, ModelType type) { 155 void TriggerChanges(SyncBackendRegistrar* registrar, ModelType type) {
153 registrar->OnChangesApplied(type, 0, NULL, 156 registrar->OnChangesApplied(type, 0, NULL,
154 syncer::ImmutableChangeRecordList()); 157 syncer::ImmutableChangeRecordList());
155 registrar->OnChangesComplete(type); 158 registrar->OnChangesComplete(type);
156 } 159 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // Should do nothing. 247 // Should do nothing.
245 TriggerChanges(&registrar, AUTOFILL); 248 TriggerChanges(&registrar, AUTOFILL);
246 249
247 registrar.OnSyncerShutdownComplete(); 250 registrar.OnSyncerShutdownComplete();
248 registrar.StopOnUIThread(); 251 registrar.StopOnUIThread();
249 } 252 }
250 253
251 } // namespace 254 } // namespace
252 255
253 } // namespace browser_sync 256 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_registrar.cc ('k') | chrome/browser/sync/test_profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698