OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Unit tests for the SyncApi. Note that a lot of the underlying | 5 // Unit tests for the SyncApi. Note that a lot of the underlying |
6 // functionality is provided by the Syncable layer, which has its own | 6 // functionality is provided by the Syncable layer, which has its own |
7 // unit tests. We'll test SyncApi specific things in this harness. | 7 // unit tests. We'll test SyncApi specific things in this harness. |
8 | 8 |
9 #include <cstddef> | 9 #include <cstddef> |
10 #include <map> | 10 #include <map> |
(...skipping 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2654 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, | 2654 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, |
2655 params.source); | 2655 params.source); |
2656 EXPECT_TRUE(types_to_download.Equals(params.types_to_download)); | 2656 EXPECT_TRUE(types_to_download.Equals(params.types_to_download)); |
2657 EXPECT_EQ(new_routing_info, params.routing_info); | 2657 EXPECT_EQ(new_routing_info, params.routing_info); |
2658 | 2658 |
2659 // Verify only the recently disabled types were purged. | 2659 // Verify only the recently disabled types were purged. |
2660 EXPECT_TRUE(sync_manager_.GetTypesWithEmptyProgressMarkerToken( | 2660 EXPECT_TRUE(sync_manager_.GetTypesWithEmptyProgressMarkerToken( |
2661 ProtocolTypes()).Equals(disabled_types)); | 2661 ProtocolTypes()).Equals(disabled_types)); |
2662 } | 2662 } |
2663 | 2663 |
| 2664 // Test that SyncManager::ClearServerData invokes the scheduler. |
| 2665 TEST_F(SyncManagerTestWithMockScheduler, ClearServerData) { |
| 2666 EXPECT_CALL(*scheduler(), Start(SyncScheduler::CLEAR_SERVER_DATA_MODE, _)); |
| 2667 CallbackCounter callback_counter; |
| 2668 sync_manager_.ClearServerData(base::Bind( |
| 2669 &CallbackCounter::Callback, base::Unretained(&callback_counter))); |
| 2670 PumpLoop(); |
| 2671 EXPECT_EQ(1, callback_counter.times_called()); |
| 2672 } |
| 2673 |
2664 // Test that PurgePartiallySyncedTypes purges only those types that have not | 2674 // Test that PurgePartiallySyncedTypes purges only those types that have not |
2665 // fully completed their initial download and apply. | 2675 // fully completed their initial download and apply. |
2666 TEST_F(SyncManagerTest, PurgePartiallySyncedTypes) { | 2676 TEST_F(SyncManagerTest, PurgePartiallySyncedTypes) { |
2667 ModelSafeRoutingInfo routing_info; | 2677 ModelSafeRoutingInfo routing_info; |
2668 GetModelSafeRoutingInfo(&routing_info); | 2678 GetModelSafeRoutingInfo(&routing_info); |
2669 ModelTypeSet enabled_types = GetRoutingInfoTypes(routing_info); | 2679 ModelTypeSet enabled_types = GetRoutingInfoTypes(routing_info); |
2670 | 2680 |
2671 UserShare* share = sync_manager_.GetUserShare(); | 2681 UserShare* share = sync_manager_.GetUserShare(); |
2672 | 2682 |
2673 // The test harness automatically initializes all types in the routing info. | 2683 // The test harness automatically initializes all types in the routing info. |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3326 // SyncManagerInitInvalidStorageTest::GetFactory will return | 3336 // SyncManagerInitInvalidStorageTest::GetFactory will return |
3327 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. | 3337 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. |
3328 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's | 3338 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's |
3329 // task is to ensure that SyncManagerImpl reported initialization failure in | 3339 // task is to ensure that SyncManagerImpl reported initialization failure in |
3330 // OnInitializationComplete callback. | 3340 // OnInitializationComplete callback. |
3331 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { | 3341 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { |
3332 EXPECT_FALSE(initialization_succeeded_); | 3342 EXPECT_FALSE(initialization_succeeded_); |
3333 } | 3343 } |
3334 | 3344 |
3335 } // namespace syncer | 3345 } // namespace syncer |
OLD | NEW |