| 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 #include "components/sync/engine_impl/sync_manager_impl.h" | 5 #include "components/sync/engine_impl/sync_manager_impl.h" | 
| 6 | 6 | 
| 7 #include <cstddef> | 7 #include <cstddef> | 
| 8 #include <memory> | 8 #include <memory> | 
| 9 #include <utility> | 9 #include <utility> | 
| 10 | 10 | 
| (...skipping 2749 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2760   EXPECT_CALL(*scheduler(), ScheduleConfiguration(_)) | 2760   EXPECT_CALL(*scheduler(), ScheduleConfiguration(_)) | 
| 2761       .WillOnce(SaveArg<0>(¶ms)); | 2761       .WillOnce(SaveArg<0>(¶ms)); | 
| 2762 | 2762 | 
| 2763   // Set data for all types. | 2763   // Set data for all types. | 
| 2764   ModelTypeSet protocol_types = ProtocolTypes(); | 2764   ModelTypeSet protocol_types = ProtocolTypes(); | 
| 2765   for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good(); | 2765   for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good(); | 
| 2766        iter.Inc()) { | 2766        iter.Inc()) { | 
| 2767     SetProgressMarkerForType(iter.Get(), true); | 2767     SetProgressMarkerForType(iter.Get(), true); | 
| 2768   } | 2768   } | 
| 2769 | 2769 | 
|  | 2770   sync_manager_.PurgeDisabledTypes(disabled_types, ModelTypeSet(), | 
|  | 2771                                    ModelTypeSet()); | 
| 2770   CallbackCounter ready_task_counter, retry_task_counter; | 2772   CallbackCounter ready_task_counter, retry_task_counter; | 
| 2771   sync_manager_.ConfigureSyncer( | 2773   sync_manager_.ConfigureSyncer( | 
| 2772       reason, types_to_download, disabled_types, ModelTypeSet(), ModelTypeSet(), | 2774       reason, types_to_download, new_routing_info, | 
| 2773       new_routing_info, base::Bind(&CallbackCounter::Callback, | 2775       base::Bind(&CallbackCounter::Callback, | 
| 2774                                    base::Unretained(&ready_task_counter)), | 2776                  base::Unretained(&ready_task_counter)), | 
| 2775       base::Bind(&CallbackCounter::Callback, | 2777       base::Bind(&CallbackCounter::Callback, | 
| 2776                  base::Unretained(&retry_task_counter))); | 2778                  base::Unretained(&retry_task_counter))); | 
| 2777   EXPECT_EQ(0, ready_task_counter.times_called()); | 2779   EXPECT_EQ(0, ready_task_counter.times_called()); | 
| 2778   EXPECT_EQ(0, retry_task_counter.times_called()); | 2780   EXPECT_EQ(0, retry_task_counter.times_called()); | 
| 2779   EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, params.source); | 2781   EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, params.source); | 
| 2780   EXPECT_EQ(types_to_download, params.types_to_download); | 2782   EXPECT_EQ(types_to_download, params.types_to_download); | 
| 2781   EXPECT_EQ(new_routing_info, params.routing_info); | 2783   EXPECT_EQ(new_routing_info, params.routing_info); | 
| 2782 | 2784 | 
| 2783   // Verify all the disabled types were purged. | 2785   // Verify all the disabled types were purged. | 
| 2784   EXPECT_EQ(enabled_types, | 2786   EXPECT_EQ(enabled_types, | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
| 2815       SetProgressMarkerForType(iter.Get(), true); | 2817       SetProgressMarkerForType(iter.Get(), true); | 
| 2816     } else { | 2818     } else { | 
| 2817       SetProgressMarkerForType(iter.Get(), false); | 2819       SetProgressMarkerForType(iter.Get(), false); | 
| 2818     } | 2820     } | 
| 2819   } | 2821   } | 
| 2820 | 2822 | 
| 2821   // Set the context to have the old routing info. | 2823   // Set the context to have the old routing info. | 
| 2822   cycle_context()->SetRoutingInfo(old_routing_info); | 2824   cycle_context()->SetRoutingInfo(old_routing_info); | 
| 2823 | 2825 | 
| 2824   CallbackCounter ready_task_counter, retry_task_counter; | 2826   CallbackCounter ready_task_counter, retry_task_counter; | 
|  | 2827   sync_manager_.PurgeDisabledTypes(ModelTypeSet(), ModelTypeSet(), | 
|  | 2828                                    ModelTypeSet()); | 
| 2825   sync_manager_.ConfigureSyncer( | 2829   sync_manager_.ConfigureSyncer( | 
| 2826       reason, types_to_download, ModelTypeSet(), ModelTypeSet(), ModelTypeSet(), | 2830       reason, types_to_download, new_routing_info, | 
| 2827       new_routing_info, base::Bind(&CallbackCounter::Callback, | 2831       base::Bind(&CallbackCounter::Callback, | 
| 2828                                    base::Unretained(&ready_task_counter)), | 2832                  base::Unretained(&ready_task_counter)), | 
| 2829       base::Bind(&CallbackCounter::Callback, | 2833       base::Bind(&CallbackCounter::Callback, | 
| 2830                  base::Unretained(&retry_task_counter))); | 2834                  base::Unretained(&retry_task_counter))); | 
| 2831   EXPECT_EQ(0, ready_task_counter.times_called()); | 2835   EXPECT_EQ(0, ready_task_counter.times_called()); | 
| 2832   EXPECT_EQ(0, retry_task_counter.times_called()); | 2836   EXPECT_EQ(0, retry_task_counter.times_called()); | 
| 2833   EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, params.source); | 2837   EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::RECONFIGURATION, params.source); | 
| 2834   EXPECT_EQ(types_to_download, params.types_to_download); | 2838   EXPECT_EQ(types_to_download, params.types_to_download); | 
| 2835   EXPECT_EQ(new_routing_info, params.routing_info); | 2839   EXPECT_EQ(new_routing_info, params.routing_info); | 
| 2836 | 2840 | 
| 2837   // Verify only the recently disabled types were purged. | 2841   // Verify only the recently disabled types were purged. | 
| 2838   EXPECT_EQ(disabled_types, sync_manager_.GetTypesWithEmptyProgressMarkerToken( | 2842   EXPECT_EQ(disabled_types, sync_manager_.GetTypesWithEmptyProgressMarkerToken( | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2901 | 2905 | 
| 2902   // Add a fully synced preferences node under the root. | 2906   // Add a fully synced preferences node under the root. | 
| 2903   std::string pref_client_tag = "prefABC"; | 2907   std::string pref_client_tag = "prefABC"; | 
| 2904   std::string pref_hashed_tag = "hashXYZ"; | 2908   std::string pref_hashed_tag = "hashXYZ"; | 
| 2905   sync_pb::EntitySpecifics pref_specifics; | 2909   sync_pb::EntitySpecifics pref_specifics; | 
| 2906   AddDefaultFieldValue(PREFERENCES, &pref_specifics); | 2910   AddDefaultFieldValue(PREFERENCES, &pref_specifics); | 
| 2907   int pref_meta = MakeServerNode(share, PREFERENCES, pref_client_tag, | 2911   int pref_meta = MakeServerNode(share, PREFERENCES, pref_client_tag, | 
| 2908                                  pref_hashed_tag, pref_specifics); | 2912                                  pref_hashed_tag, pref_specifics); | 
| 2909 | 2913 | 
| 2910   // And now, the purge. | 2914   // And now, the purge. | 
| 2911   EXPECT_TRUE(sync_manager_.PurgePartiallySyncedTypes()); | 2915   sync_manager_.PurgePartiallySyncedTypes(); | 
| 2912 | 2916 | 
| 2913   // Ensure that autofill lost its progress marker, but preferences did not. | 2917   // Ensure that autofill lost its progress marker, but preferences did not. | 
| 2914   ModelTypeSet empty_tokens = | 2918   ModelTypeSet empty_tokens = | 
| 2915       sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()); | 2919       sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()); | 
| 2916   EXPECT_TRUE(empty_tokens.Has(AUTOFILL)); | 2920   EXPECT_TRUE(empty_tokens.Has(AUTOFILL)); | 
| 2917   EXPECT_FALSE(empty_tokens.Has(PREFERENCES)); | 2921   EXPECT_FALSE(empty_tokens.Has(PREFERENCES)); | 
| 2918 | 2922 | 
| 2919   // Ensure that autofill lost its node, but preferences did not. | 2923   // Ensure that autofill lost its node, but preferences did not. | 
| 2920   { | 2924   { | 
| 2921     syncable::ReadTransaction trans(FROM_HERE, share->directory.get()); | 2925     syncable::ReadTransaction trans(FROM_HERE, share->directory.get()); | 
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3510 // SyncManagerInitInvalidStorageTest::GetFactory will return | 3514 // SyncManagerInitInvalidStorageTest::GetFactory will return | 
| 3511 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. | 3515 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. | 
| 3512 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's | 3516 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's | 
| 3513 // task is to ensure that SyncManagerImpl reported initialization failure in | 3517 // task is to ensure that SyncManagerImpl reported initialization failure in | 
| 3514 // OnInitializationComplete callback. | 3518 // OnInitializationComplete callback. | 
| 3515 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { | 3519 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { | 
| 3516   EXPECT_FALSE(initialization_succeeded_); | 3520   EXPECT_FALSE(initialization_succeeded_); | 
| 3517 } | 3521 } | 
| 3518 | 3522 | 
| 3519 }  // namespace syncer | 3523 }  // namespace syncer | 
| OLD | NEW | 
|---|