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

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

Issue 7497014: Revert 94128 - [Sync] Refactor sync datatype error handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 EXPECT_CALL(service_, GetLastSessionSnapshot()) 58 EXPECT_CALL(service_, GetLastSessionSnapshot())
59 .WillOnce(Return(snap_.get())); 59 .WillOnce(Return(snap_.get()));
60 } 60 }
61 61
62 void SendConfigureDone(DataTypeManager::ConfigureStatus status, 62 void SendConfigureDone(DataTypeManager::ConfigureResult result,
63 const syncable::ModelTypeSet& types) { 63 const syncable::ModelTypeSet& types) {
64 if (status == DataTypeManager::OK) { 64 DataTypeManager::ConfigureResultWithErrorLocation result_with_location(
65 DataTypeManager::ConfigureResult result(status, types); 65 result, FROM_HERE, types);
66 NotificationService::current()->Notify( 66 NotificationService::current()->Notify(
67 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, 67 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE,
68 Source<DataTypeManager>(&manager_), 68 Source<DataTypeManager>(&manager_),
69 Details<const DataTypeManager::ConfigureResult>(&result)); 69 Details<DataTypeManager::ConfigureResultWithErrorLocation>(
70 } else { 70 &result_with_location));
71 DataTypeManager::ConfigureResult result(
72 status,
73 types,
74 syncable::ModelTypeSet(),
75 FROM_HERE);
76 NotificationService::current()->Notify(
77 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE,
78 Source<DataTypeManager>(&manager_),
79 Details<const DataTypeManager::ConfigureResult>(&result));
80 }
81 } 71 }
82 72
83 ProfileSyncService* service() { return &service_; } 73 ProfileSyncService* service() { return &service_; }
84 DataTypeManagerMock* manager() { return &manager_; } 74 DataTypeManagerMock* manager() { return &manager_; }
85 const syncable::ModelTypeSet& preferred_types() { return preferred_types_; } 75 const syncable::ModelTypeSet& preferred_types() { return preferred_types_; }
86 void RemovePreferredType(syncable::ModelType type) { 76 void RemovePreferredType(syncable::ModelType type) {
87 preferred_types_.erase(type); 77 preferred_types_.erase(type);
88 Mock::VerifyAndClear(&service_); 78 Mock::VerifyAndClear(&service_);
89 ON_CALL(service_, GetPreferredDataTypes(_)). 79 ON_CALL(service_, GetPreferredDataTypes(_)).
90 WillByDefault(SetArgumentPointee<0>(preferred_types_)); 80 WillByDefault(SetArgumentPointee<0>(preferred_types_));
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 EXPECT_CALL(*manager(), state()) 299 EXPECT_CALL(*manager(), state())
310 .WillOnce(Return(DataTypeManager::CONFIGURED)); 300 .WillOnce(Return(DataTypeManager::CONFIGURED));
311 EXPECT_CALL(*manager(), Configure(_, sync_api::CONFIGURE_REASON_MIGRATION)) 301 EXPECT_CALL(*manager(), Configure(_, sync_api::CONFIGURE_REASON_MIGRATION))
312 .Times(1); 302 .Times(1);
313 migrator.MigrateTypes(to_migrate); 303 migrator.MigrateTypes(to_migrate);
314 SendConfigureDone(DataTypeManager::ABORTED, syncable::ModelTypeSet()); 304 SendConfigureDone(DataTypeManager::ABORTED, syncable::ModelTypeSet());
315 EXPECT_EQ(BackendMigrator::IDLE, migrator.state()); 305 EXPECT_EQ(BackendMigrator::IDLE, migrator.state());
316 } 306 }
317 307
318 }; // namespace browser_sync 308 }; // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/backend_migrator.cc ('k') | chrome/browser/sync/glue/app_model_associator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698