OLD | NEW |
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 "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 | 13 |
13 using ::testing::_; | 14 using ::testing::_; |
14 using ::testing::Eq; | 15 using ::testing::Eq; |
15 using ::testing::Mock; | 16 using ::testing::Mock; |
16 using ::testing::NiceMock; | 17 using ::testing::NiceMock; |
17 using ::testing::Return; | 18 using ::testing::Return; |
18 using ::testing::SetArgumentPointee; | 19 using ::testing::SetArgumentPointee; |
19 | 20 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 false, false, 0, 0, 0, false, sessions::SyncSourceInfo(), 0)); | 57 false, false, 0, 0, 0, false, sessions::SyncSourceInfo(), 0)); |
57 EXPECT_CALL(service_, GetLastSessionSnapshot()) | 58 EXPECT_CALL(service_, GetLastSessionSnapshot()) |
58 .WillOnce(Return(snap_.get())); | 59 .WillOnce(Return(snap_.get())); |
59 } | 60 } |
60 | 61 |
61 void SendConfigureDone(DataTypeManager::ConfigureResult result, | 62 void SendConfigureDone(DataTypeManager::ConfigureResult result, |
62 const syncable::ModelTypeSet& types) { | 63 const syncable::ModelTypeSet& types) { |
63 DataTypeManager::ConfigureResultWithErrorLocation result_with_location( | 64 DataTypeManager::ConfigureResultWithErrorLocation result_with_location( |
64 result, FROM_HERE, types); | 65 result, FROM_HERE, types); |
65 NotificationService::current()->Notify( | 66 NotificationService::current()->Notify( |
66 NotificationType::SYNC_CONFIGURE_DONE, | 67 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, |
67 Source<DataTypeManager>(&manager_), | 68 Source<DataTypeManager>(&manager_), |
68 Details<DataTypeManager::ConfigureResultWithErrorLocation>( | 69 Details<DataTypeManager::ConfigureResultWithErrorLocation>( |
69 &result_with_location)); | 70 &result_with_location)); |
70 } | 71 } |
71 | 72 |
72 ProfileSyncService* service() { return &service_; } | 73 ProfileSyncService* service() { return &service_; } |
73 DataTypeManagerMock* manager() { return &manager_; } | 74 DataTypeManagerMock* manager() { return &manager_; } |
74 const syncable::ModelTypeSet& preferred_types() { return preferred_types_; } | 75 const syncable::ModelTypeSet& preferred_types() { return preferred_types_; } |
75 void RemovePreferredType(syncable::ModelType type) { | 76 void RemovePreferredType(syncable::ModelType type) { |
76 preferred_types_.erase(type); | 77 preferred_types_.erase(type); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 EXPECT_CALL(*manager(), state()) | 299 EXPECT_CALL(*manager(), state()) |
299 .WillOnce(Return(DataTypeManager::CONFIGURED)); | 300 .WillOnce(Return(DataTypeManager::CONFIGURED)); |
300 EXPECT_CALL(*manager(), Configure(_, sync_api::CONFIGURE_REASON_MIGRATION)) | 301 EXPECT_CALL(*manager(), Configure(_, sync_api::CONFIGURE_REASON_MIGRATION)) |
301 .Times(1); | 302 .Times(1); |
302 migrator.MigrateTypes(to_migrate); | 303 migrator.MigrateTypes(to_migrate); |
303 SendConfigureDone(DataTypeManager::ABORTED, syncable::ModelTypeSet()); | 304 SendConfigureDone(DataTypeManager::ABORTED, syncable::ModelTypeSet()); |
304 EXPECT_EQ(BackendMigrator::IDLE, migrator.state()); | 305 EXPECT_EQ(BackendMigrator::IDLE, migrator.state()); |
305 } | 306 } |
306 | 307 |
307 }; // namespace browser_sync | 308 }; // namespace browser_sync |
OLD | NEW |