Index: components/sync/driver/backend_migrator_unittest.cc |
diff --git a/components/sync_driver/backend_migrator_unittest.cc b/components/sync/driver/backend_migrator_unittest.cc |
similarity index 82% |
rename from components/sync_driver/backend_migrator_unittest.cc |
rename to components/sync/driver/backend_migrator_unittest.cc |
index 2a84b90949ab94a6468ec8fac2db1aad83672806..ea6f700d26a8756c475bcf18a28c0f01040a915c 100644 |
--- a/components/sync_driver/backend_migrator_unittest.cc |
+++ b/components/sync/driver/backend_migrator_unittest.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "components/sync_driver/backend_migrator.h" |
+#include "components/sync/driver/backend_migrator.h" |
#include "base/message_loop/message_loop.h" |
#include "base/run_loop.h" |
@@ -10,10 +10,10 @@ |
#include "components/sync/base/model_type_test_util.h" |
#include "components/sync/core/test/test_user_share.h" |
#include "components/sync/core/write_transaction.h" |
+#include "components/sync/driver/data_type_manager_mock.h" |
+#include "components/sync/driver/fake_sync_service.h" |
#include "components/sync/protocol/sync.pb.h" |
#include "components/sync/syncable/directory.h" // TODO(tim): Remove. Bug 131130. |
-#include "components/sync_driver/data_type_manager_mock.h" |
-#include "components/sync_driver/fake_sync_service.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -31,8 +31,8 @@ using syncer::sessions::SyncSessionSnapshot; |
class SyncBackendMigratorTest : public testing::Test { |
public: |
- SyncBackendMigratorTest() { } |
- virtual ~SyncBackendMigratorTest() { } |
+ SyncBackendMigratorTest() {} |
+ virtual ~SyncBackendMigratorTest() {} |
virtual void SetUp() { |
test_user_share_.SetUp(); |
@@ -41,10 +41,9 @@ class SyncBackendMigratorTest : public testing::Test { |
preferred_types_.Put(syncer::PREFERENCES); |
preferred_types_.Put(syncer::AUTOFILL); |
- migrator_.reset( |
- new BackendMigrator( |
- "Profile0", test_user_share_.user_share(), service(), manager(), |
- base::Closure())); |
+ migrator_.reset(new BackendMigrator("Profile0", |
+ test_user_share_.user_share(), |
+ service(), manager(), base::Closure())); |
SetUnsyncedTypes(syncer::ModelTypeSet()); |
} |
@@ -56,10 +55,9 @@ class SyncBackendMigratorTest : public testing::Test { |
// Marks all types in |unsynced_types| as unsynced and all other |
// types as synced. |
void SetUnsyncedTypes(syncer::ModelTypeSet unsynced_types) { |
- syncer::WriteTransaction trans(FROM_HERE, |
- test_user_share_.user_share()); |
- for (int i = syncer::FIRST_REAL_MODEL_TYPE; |
- i < syncer::MODEL_TYPE_COUNT; ++i) { |
+ syncer::WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); |
+ for (int i = syncer::FIRST_REAL_MODEL_TYPE; i < syncer::MODEL_TYPE_COUNT; |
+ ++i) { |
syncer::ModelType type = syncer::ModelTypeFromInt(i); |
sync_pb::DataTypeProgressMarker progress_marker; |
if (!unsynced_types.Has(type)) { |
@@ -75,9 +73,7 @@ class SyncBackendMigratorTest : public testing::Test { |
DataTypeManager::ConfigureResult result(status, requested_types); |
migrator_->OnConfigureDone(result); |
} else { |
- DataTypeManager::ConfigureResult result( |
- status, |
- requested_types); |
+ DataTypeManager::ConfigureResult result(status, requested_types); |
migrator_->OnConfigureDone(result); |
} |
base::RunLoop run_loop; |
@@ -122,12 +118,11 @@ TEST_F(SyncBackendMigratorTest, Sanity) { |
EXPECT_CALL(*manager(), state()) |
.WillOnce(Return(DataTypeManager::CONFIGURED)); |
- EXPECT_CALL( |
- *manager(), |
- PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)).Times(1); |
- EXPECT_CALL( |
- *manager(), |
- Configure(_, syncer::CONFIGURE_REASON_MIGRATION)).Times(1); |
+ EXPECT_CALL(*manager(), |
+ PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)) |
+ .Times(1); |
+ EXPECT_CALL(*manager(), Configure(_, syncer::CONFIGURE_REASON_MIGRATION)) |
+ .Times(1); |
migrator()->MigrateTypes(to_migrate); |
EXPECT_EQ(BackendMigrator::DISABLING_TYPES, migrator()->state()); |
@@ -154,8 +149,8 @@ TEST_F(SyncBackendMigratorTest, MigrateNigori) { |
EXPECT_CALL(*manager(), state()) |
.WillOnce(Return(DataTypeManager::CONFIGURED)); |
- EXPECT_CALL(*manager(), PurgeForMigration(_, |
- syncer::CONFIGURE_REASON_MIGRATION)); |
+ EXPECT_CALL(*manager(), |
+ PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)); |
migrator()->MigrateTypes(to_migrate); |
EXPECT_EQ(BackendMigrator::DISABLING_TYPES, migrator()->state()); |
@@ -169,7 +164,6 @@ TEST_F(SyncBackendMigratorTest, MigrateNigori) { |
EXPECT_EQ(BackendMigrator::IDLE, migrator()->state()); |
} |
- |
// Test that the migrator waits for the data type manager to be idle before |
// starting a migration. |
TEST_F(SyncBackendMigratorTest, WaitToStart) { |
@@ -205,9 +199,9 @@ TEST_F(SyncBackendMigratorTest, RestartMigration) { |
EXPECT_CALL(*manager(), state()) |
.WillOnce(Return(DataTypeManager::CONFIGURED)); |
- EXPECT_CALL( |
- *manager(), |
- PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)).Times(2); |
+ EXPECT_CALL(*manager(), |
+ PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)) |
+ .Times(2); |
migrator()->MigrateTypes(to_migrate1); |
EXPECT_EQ(BackendMigrator::DISABLING_TYPES, migrator()->state()); |
@@ -217,9 +211,9 @@ TEST_F(SyncBackendMigratorTest, RestartMigration) { |
Difference(preferred_types(), to_migrate1); |
Mock::VerifyAndClearExpectations(manager()); |
- EXPECT_CALL( |
- *manager(), |
- PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)).Times(1); |
+ EXPECT_CALL(*manager(), |
+ PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)) |
+ .Times(1); |
EXPECT_CALL(*manager(), Configure(_, syncer::CONFIGURE_REASON_MIGRATION)) |
.Times(1); |
SetUnsyncedTypes(to_migrate1); |
@@ -242,14 +236,16 @@ TEST_F(SyncBackendMigratorTest, InterruptedWhileDisablingTypes) { |
EXPECT_CALL(*manager(), state()) |
.WillOnce(Return(DataTypeManager::CONFIGURED)); |
- EXPECT_CALL(*manager(), PurgeForMigration(HasModelTypes(to_migrate), |
- syncer::CONFIGURE_REASON_MIGRATION)); |
+ EXPECT_CALL(*manager(), |
+ PurgeForMigration(HasModelTypes(to_migrate), |
+ syncer::CONFIGURE_REASON_MIGRATION)); |
migrator()->MigrateTypes(to_migrate); |
EXPECT_EQ(BackendMigrator::DISABLING_TYPES, migrator()->state()); |
Mock::VerifyAndClearExpectations(manager()); |
- EXPECT_CALL(*manager(), PurgeForMigration(HasModelTypes(to_migrate), |
- syncer::CONFIGURE_REASON_MIGRATION)); |
+ EXPECT_CALL(*manager(), |
+ PurgeForMigration(HasModelTypes(to_migrate), |
+ syncer::CONFIGURE_REASON_MIGRATION)); |
SetUnsyncedTypes(syncer::ModelTypeSet()); |
SendConfigureDone(DataTypeManager::OK, preferred_types()); |
@@ -267,12 +263,11 @@ TEST_F(SyncBackendMigratorTest, WaitingForPurge) { |
EXPECT_CALL(*manager(), state()) |
.WillOnce(Return(DataTypeManager::CONFIGURED)); |
- EXPECT_CALL( |
- *manager(), |
- PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)).Times(1); |
- EXPECT_CALL( |
- *manager(), |
- Configure(_, syncer::CONFIGURE_REASON_MIGRATION)).Times(1); |
+ EXPECT_CALL(*manager(), |
+ PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)) |
+ .Times(1); |
+ EXPECT_CALL(*manager(), Configure(_, syncer::CONFIGURE_REASON_MIGRATION)) |
+ .Times(1); |
migrator()->MigrateTypes(to_migrate); |
EXPECT_EQ(BackendMigrator::DISABLING_TYPES, migrator()->state()); |
@@ -297,12 +292,11 @@ TEST_F(SyncBackendMigratorTest, MigratedTypeDisabledByUserDuringMigration) { |
EXPECT_CALL(*manager(), state()) |
.WillOnce(Return(DataTypeManager::CONFIGURED)); |
- EXPECT_CALL( |
- *manager(), |
- PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)).Times(1); |
- EXPECT_CALL( |
- *manager(), |
- Configure(_, syncer::CONFIGURE_REASON_MIGRATION)).Times(1); |
+ EXPECT_CALL(*manager(), |
+ PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)) |
+ .Times(1); |
+ EXPECT_CALL(*manager(), Configure(_, syncer::CONFIGURE_REASON_MIGRATION)) |
+ .Times(1); |
migrator()->MigrateTypes(to_migrate); |
RemovePreferredType(syncer::PREFERENCES); |
@@ -320,9 +314,9 @@ TEST_F(SyncBackendMigratorTest, ConfigureFailure) { |
EXPECT_CALL(*manager(), state()) |
.WillOnce(Return(DataTypeManager::CONFIGURED)); |
- EXPECT_CALL( |
- *manager(), |
- PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)).Times(1); |
+ EXPECT_CALL(*manager(), |
+ PurgeForMigration(_, syncer::CONFIGURE_REASON_MIGRATION)) |
+ .Times(1); |
migrator()->MigrateTypes(to_migrate); |
SetUnsyncedTypes(syncer::ModelTypeSet()); |
SendConfigureDone(DataTypeManager::ABORTED, syncer::ModelTypeSet()); |