OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/sync/driver/backend_migrator.h" | 5 #include "components/sync/driver/backend_migrator.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
| 9 #include "base/memory/ptr_util.h" |
9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
11 #include "base/tracked_objects.h" | 12 #include "base/tracked_objects.h" |
12 #include "components/sync/base/model_type_test_util.h" | 13 #include "components/sync/base/model_type_test_util.h" |
13 #include "components/sync/driver/data_type_manager_mock.h" | 14 #include "components/sync/driver/data_type_manager_mock.h" |
14 #include "components/sync/driver/fake_sync_service.h" | 15 #include "components/sync/driver/fake_sync_service.h" |
15 #include "components/sync/protocol/sync.pb.h" | 16 #include "components/sync/protocol/sync.pb.h" |
16 #include "components/sync/syncable/directory.h" | 17 #include "components/sync/syncable/directory.h" |
17 #include "components/sync/syncable/test_user_share.h" | 18 #include "components/sync/syncable/test_user_share.h" |
18 #include "components/sync/syncable/write_transaction.h" | 19 #include "components/sync/syncable/write_transaction.h" |
(...skipping 13 matching lines...) Expand all Loading... |
32 SyncBackendMigratorTest() {} | 33 SyncBackendMigratorTest() {} |
33 virtual ~SyncBackendMigratorTest() {} | 34 virtual ~SyncBackendMigratorTest() {} |
34 | 35 |
35 virtual void SetUp() { | 36 virtual void SetUp() { |
36 test_user_share_.SetUp(); | 37 test_user_share_.SetUp(); |
37 Mock::VerifyAndClear(manager()); | 38 Mock::VerifyAndClear(manager()); |
38 preferred_types_.Put(BOOKMARKS); | 39 preferred_types_.Put(BOOKMARKS); |
39 preferred_types_.Put(PREFERENCES); | 40 preferred_types_.Put(PREFERENCES); |
40 preferred_types_.Put(AUTOFILL); | 41 preferred_types_.Put(AUTOFILL); |
41 | 42 |
42 migrator_.reset(new BackendMigrator("Profile0", | 43 migrator_ = base::MakeUnique<BackendMigrator>( |
43 test_user_share_.user_share(), | 44 "Profile0", test_user_share_.user_share(), service(), manager(), |
44 service(), manager(), base::Closure())); | 45 base::Closure()); |
45 SetUnsyncedTypes(ModelTypeSet()); | 46 SetUnsyncedTypes(ModelTypeSet()); |
46 } | 47 } |
47 | 48 |
48 virtual void TearDown() { | 49 virtual void TearDown() { |
49 migrator_.reset(); | 50 migrator_.reset(); |
50 test_user_share_.TearDown(); | 51 test_user_share_.TearDown(); |
51 } | 52 } |
52 | 53 |
53 // Marks all types in |unsynced_types| as unsynced and all other | 54 // Marks all types in |unsynced_types| as unsynced and all other |
54 // types as synced. | 55 // types as synced. |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 .WillOnce(Return(DataTypeManager::CONFIGURED)); | 298 .WillOnce(Return(DataTypeManager::CONFIGURED)); |
298 EXPECT_CALL(*manager(), PurgeForMigration(_, CONFIGURE_REASON_MIGRATION)) | 299 EXPECT_CALL(*manager(), PurgeForMigration(_, CONFIGURE_REASON_MIGRATION)) |
299 .Times(1); | 300 .Times(1); |
300 migrator()->MigrateTypes(to_migrate); | 301 migrator()->MigrateTypes(to_migrate); |
301 SetUnsyncedTypes(ModelTypeSet()); | 302 SetUnsyncedTypes(ModelTypeSet()); |
302 SendConfigureDone(DataTypeManager::ABORTED, ModelTypeSet()); | 303 SendConfigureDone(DataTypeManager::ABORTED, ModelTypeSet()); |
303 EXPECT_EQ(BackendMigrator::IDLE, migrator()->state()); | 304 EXPECT_EQ(BackendMigrator::IDLE, migrator()->state()); |
304 } | 305 } |
305 | 306 |
306 }; // namespace syncer | 307 }; // namespace syncer |
OLD | NEW |