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

Side by Side Diff: sync/internal_api/sync_rollback_manager_unittest.cc

Issue 1144443004: Revert of [Sync] Refactoring polling to be reliable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sync/internal_api/sync_rollback_manager.h" 5 #include "sync/internal_api/sync_rollback_manager.h"
6 6
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "sync/internal_api/public/read_node.h" 9 #include "sync/internal_api/public/read_node.h"
10 #include "sync/internal_api/public/read_transaction.h" 10 #include "sync/internal_api/public/read_transaction.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 delegate.add_expected_delete(new_pref_id); 196 delegate.add_expected_delete(new_pref_id);
197 EXPECT_CALL(delegate, OnChangesApplied(_, _, _, _)) 197 EXPECT_CALL(delegate, OnChangesApplied(_, _, _, _))
198 .Times(1) 198 .Times(1)
199 .WillOnce(DoDefault()); 199 .WillOnce(DoDefault());
200 EXPECT_CALL(delegate, OnChangesComplete(_)).Times(1); 200 EXPECT_CALL(delegate, OnChangesComplete(_)).Times(1);
201 EXPECT_CALL(*this, OnActionableError(Truly(IsRollbackDoneAction))).Times(1); 201 EXPECT_CALL(*this, OnActionableError(Truly(IsRollbackDoneAction))).Times(1);
202 202
203 ModelSafeRoutingInfo routing_info; 203 ModelSafeRoutingInfo routing_info;
204 routing_info[PREFERENCES] = GROUP_UI; 204 routing_info[PREFERENCES] = GROUP_UI;
205 rollback_manager.StartSyncingNormally(routing_info, base::Time()); 205 rollback_manager.StartSyncingNormally(routing_info);
206 } 206 }
207 207
208 TEST_F(SyncRollbackManagerTest, NoRollbackOfTypesNotBackedUp) { 208 TEST_F(SyncRollbackManagerTest, NoRollbackOfTypesNotBackedUp) {
209 PrepopulateDb(PREFERENCES, "pref1"); 209 PrepopulateDb(PREFERENCES, "pref1");
210 210
211 TestChangeDelegate delegate; 211 TestChangeDelegate delegate;
212 SyncRollbackManager rollback_manager; 212 SyncRollbackManager rollback_manager;
213 InitManager(&rollback_manager, ModelTypeSet(PREFERENCES, APPS), &delegate, 213 InitManager(&rollback_manager, ModelTypeSet(PREFERENCES, APPS), &delegate,
214 InternalComponentsFactory::STORAGE_ON_DISK); 214 InternalComponentsFactory::STORAGE_ON_DISK);
215 215
216 // Simulate new entry added during type initialization. 216 // Simulate new entry added during type initialization.
217 int64 new_pref_id = 217 int64 new_pref_id =
218 CreateEntry(rollback_manager.GetUserShare(), PREFERENCES, "pref2"); 218 CreateEntry(rollback_manager.GetUserShare(), PREFERENCES, "pref2");
219 CreateEntry(rollback_manager.GetUserShare(), APPS, "app1"); 219 CreateEntry(rollback_manager.GetUserShare(), APPS, "app1");
220 220
221 delegate.add_expected_delete(new_pref_id); 221 delegate.add_expected_delete(new_pref_id);
222 EXPECT_CALL(delegate, OnChangesApplied(_, _, _, _)) 222 EXPECT_CALL(delegate, OnChangesApplied(_, _, _, _))
223 .Times(1) 223 .Times(1)
224 .WillOnce(DoDefault()); 224 .WillOnce(DoDefault());
225 EXPECT_CALL(delegate, OnChangesComplete(_)).Times(1); 225 EXPECT_CALL(delegate, OnChangesComplete(_)).Times(1);
226 226
227 ModelSafeRoutingInfo routing_info; 227 ModelSafeRoutingInfo routing_info;
228 routing_info[PREFERENCES] = GROUP_UI; 228 routing_info[PREFERENCES] = GROUP_UI;
229 rollback_manager.StartSyncingNormally(routing_info, base::Time()); 229 rollback_manager.StartSyncingNormally(routing_info);
230 230
231 // APP entry is still valid. 231 // APP entry is still valid.
232 EXPECT_TRUE(VerifyEntry(rollback_manager.GetUserShare(), APPS, "app1")); 232 EXPECT_TRUE(VerifyEntry(rollback_manager.GetUserShare(), APPS, "app1"));
233 } 233 }
234 234
235 TEST_F(SyncRollbackManagerTest, BackupDbNotChangedOnAbort) { 235 TEST_F(SyncRollbackManagerTest, BackupDbNotChangedOnAbort) {
236 PrepopulateDb(PREFERENCES, "pref1"); 236 PrepopulateDb(PREFERENCES, "pref1");
237 237
238 TestChangeDelegate delegate; 238 TestChangeDelegate delegate;
239 scoped_ptr<SyncRollbackManager> rollback_manager( 239 scoped_ptr<SyncRollbackManager> rollback_manager(
(...skipping 19 matching lines...) Expand all
259 // Test graceful shutdown on initialization failure. 259 // Test graceful shutdown on initialization failure.
260 scoped_ptr<SyncRollbackManager> rollback_manager( 260 scoped_ptr<SyncRollbackManager> rollback_manager(
261 new SyncRollbackManager); 261 new SyncRollbackManager);
262 InitManager(rollback_manager.get(), ModelTypeSet(PREFERENCES), NULL, 262 InitManager(rollback_manager.get(), ModelTypeSet(PREFERENCES), NULL,
263 InternalComponentsFactory::STORAGE_ON_DISK); 263 InternalComponentsFactory::STORAGE_ON_DISK);
264 } 264 }
265 265
266 } // anonymous namespace 266 } // anonymous namespace
267 267
268 } // namespace syncer 268 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/sync_rollback_manager_base.cc ('k') | sync/internal_api/test/fake_sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698