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

Side by Side Diff: chrome/browser/sync/backend_migrator_unittest.cc

Issue 7477004: Simulate transient error and verify exponential backoff. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing a typo. Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/backend_migrator.h" 5 #include "chrome/browser/sync/backend_migrator.h"
6 6
7 #include "chrome/browser/sync/glue/data_type_manager_mock.h" 7 #include "chrome/browser/sync/glue/data_type_manager_mock.h"
8 #include "chrome/browser/sync/profile_sync_service_mock.h" 8 #include "chrome/browser/sync/profile_sync_service_mock.h"
9 #include "chrome/browser/sync/sessions/session_state.h" 9 #include "chrome/browser/sync/sessions/session_state.h"
10 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void ReturnNonEmptyProgressMarkersInSnapshot( 47 void ReturnNonEmptyProgressMarkersInSnapshot(
48 const syncable::ModelTypeSet& for_types) { 48 const syncable::ModelTypeSet& for_types) {
49 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; 49 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT];
50 for (syncable::ModelTypeSet::const_iterator it = for_types.begin(); 50 for (syncable::ModelTypeSet::const_iterator it = for_types.begin();
51 it != for_types.end(); ++it) { 51 it != for_types.end(); ++it) {
52 download_progress_markers[*it] = "foobar"; 52 download_progress_markers[*it] = "foobar";
53 } 53 }
54 54
55 snap_.reset(new SyncSessionSnapshot(SyncerStatus(), ErrorCounters(), 55 snap_.reset(new SyncSessionSnapshot(SyncerStatus(), ErrorCounters(),
56 0, false, syncable::ModelTypeBitSet(), download_progress_markers, 56 0, false, syncable::ModelTypeBitSet(), download_progress_markers,
57 false, false, 0, 0, 0, false, sessions::SyncSourceInfo(), 0)); 57 false, false, 0, 0, 0, false, sessions::SyncSourceInfo(), 0,
58 base::Time::Now()));
58 EXPECT_CALL(service_, GetLastSessionSnapshot()) 59 EXPECT_CALL(service_, GetLastSessionSnapshot())
59 .WillOnce(Return(snap_.get())); 60 .WillOnce(Return(snap_.get()));
60 } 61 }
61 62
62 void SendConfigureDone(DataTypeManager::ConfigureStatus status, 63 void SendConfigureDone(DataTypeManager::ConfigureStatus status,
63 const syncable::ModelTypeSet& types) { 64 const syncable::ModelTypeSet& types) {
64 if (status == DataTypeManager::OK) { 65 if (status == DataTypeManager::OK) {
65 DataTypeManager::ConfigureResult result(status, types); 66 DataTypeManager::ConfigureResult result(status, types);
66 NotificationService::current()->Notify( 67 NotificationService::current()->Notify(
67 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, 68 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE,
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 EXPECT_CALL(*manager(), state()) 310 EXPECT_CALL(*manager(), state())
310 .WillOnce(Return(DataTypeManager::CONFIGURED)); 311 .WillOnce(Return(DataTypeManager::CONFIGURED));
311 EXPECT_CALL(*manager(), Configure(_, sync_api::CONFIGURE_REASON_MIGRATION)) 312 EXPECT_CALL(*manager(), Configure(_, sync_api::CONFIGURE_REASON_MIGRATION))
312 .Times(1); 313 .Times(1);
313 migrator.MigrateTypes(to_migrate); 314 migrator.MigrateTypes(to_migrate);
314 SendConfigureDone(DataTypeManager::ABORTED, syncable::ModelTypeSet()); 315 SendConfigureDone(DataTypeManager::ABORTED, syncable::ModelTypeSet());
315 EXPECT_EQ(BackendMigrator::IDLE, migrator.state()); 316 EXPECT_EQ(BackendMigrator::IDLE, migrator.state());
316 } 317 }
317 318
318 }; // namespace browser_sync 319 }; // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698