| 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/sessions/sync_error.h" |
| 7 #include "chrome/browser/sync/glue/data_type_manager_mock.h" | 8 #include "chrome/browser/sync/glue/data_type_manager_mock.h" |
| 8 #include "chrome/browser/sync/profile_sync_service_mock.h" | 9 #include "chrome/browser/sync/profile_sync_service_mock.h" |
| 9 #include "chrome/browser/sync/sessions/session_state.h" | 10 #include "chrome/browser/sync/sessions/session_state.h" |
| 10 #include "chrome/common/chrome_notification_types.h" | 11 #include "chrome/common/chrome_notification_types.h" |
| 11 #include "chrome/test/base/testing_browser_process_test.h" | 12 #include "chrome/test/base/testing_browser_process_test.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 using ::testing::_; | 16 using ::testing::_; |
| 16 using ::testing::Eq; | 17 using ::testing::Eq; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const syncable::ModelTypeSet& for_types) { | 50 const syncable::ModelTypeSet& for_types) { |
| 50 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; | 51 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; |
| 51 for (syncable::ModelTypeSet::const_iterator it = for_types.begin(); | 52 for (syncable::ModelTypeSet::const_iterator it = for_types.begin(); |
| 52 it != for_types.end(); ++it) { | 53 it != for_types.end(); ++it) { |
| 53 download_progress_markers[*it] = "foobar"; | 54 download_progress_markers[*it] = "foobar"; |
| 54 } | 55 } |
| 55 | 56 |
| 56 snap_.reset(new SyncSessionSnapshot(SyncerStatus(), ErrorCounters(), | 57 snap_.reset(new SyncSessionSnapshot(SyncerStatus(), ErrorCounters(), |
| 57 0, false, syncable::ModelTypeBitSet(), download_progress_markers, | 58 0, false, syncable::ModelTypeBitSet(), download_progress_markers, |
| 58 false, false, 0, 0, 0, false, sessions::SyncSourceInfo(), 0, | 59 false, false, 0, 0, 0, false, sessions::SyncSourceInfo(), 0, |
| 59 base::Time::Now())); | 60 base::Time::Now(), browser_sync::sessions::SyncError())); |
| 60 EXPECT_CALL(service_, GetLastSessionSnapshot()) | 61 EXPECT_CALL(service_, GetLastSessionSnapshot()) |
| 61 .WillOnce(Return(snap_.get())); | 62 .WillOnce(Return(snap_.get())); |
| 62 } | 63 } |
| 63 | 64 |
| 64 void SendConfigureDone(DataTypeManager::ConfigureStatus status, | 65 void SendConfigureDone(DataTypeManager::ConfigureStatus status, |
| 65 const syncable::ModelTypeSet& types) { | 66 const syncable::ModelTypeSet& types) { |
| 66 if (status == DataTypeManager::OK) { | 67 if (status == DataTypeManager::OK) { |
| 67 DataTypeManager::ConfigureResult result(status, types); | 68 DataTypeManager::ConfigureResult result(status, types); |
| 68 NotificationService::current()->Notify( | 69 NotificationService::current()->Notify( |
| 69 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, | 70 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 EXPECT_CALL(*manager(), state()) | 312 EXPECT_CALL(*manager(), state()) |
| 312 .WillOnce(Return(DataTypeManager::CONFIGURED)); | 313 .WillOnce(Return(DataTypeManager::CONFIGURED)); |
| 313 EXPECT_CALL(*manager(), Configure(_, sync_api::CONFIGURE_REASON_MIGRATION)) | 314 EXPECT_CALL(*manager(), Configure(_, sync_api::CONFIGURE_REASON_MIGRATION)) |
| 314 .Times(1); | 315 .Times(1); |
| 315 migrator.MigrateTypes(to_migrate); | 316 migrator.MigrateTypes(to_migrate); |
| 316 SendConfigureDone(DataTypeManager::ABORTED, syncable::ModelTypeSet()); | 317 SendConfigureDone(DataTypeManager::ABORTED, syncable::ModelTypeSet()); |
| 317 EXPECT_EQ(BackendMigrator::IDLE, migrator.state()); | 318 EXPECT_EQ(BackendMigrator::IDLE, migrator.state()); |
| 318 } | 319 } |
| 319 | 320 |
| 320 }; // namespace browser_sync | 321 }; // namespace browser_sync |
| OLD | NEW |