| 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/browser_sync/abstract_profile_sync_service_test.h" | 5 #include "components/browser_sync/abstract_profile_sync_service_test.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 SyncEngineForProfileSyncTest( | 42 SyncEngineForProfileSyncTest( |
| 43 const base::FilePath& temp_dir, | 43 const base::FilePath& temp_dir, |
| 44 syncer::SyncClient* sync_client, | 44 syncer::SyncClient* sync_client, |
| 45 invalidation::InvalidationService* invalidator, | 45 invalidation::InvalidationService* invalidator, |
| 46 const base::WeakPtr<syncer::SyncPrefs>& sync_prefs, | 46 const base::WeakPtr<syncer::SyncPrefs>& sync_prefs, |
| 47 const base::Closure& callback); | 47 const base::Closure& callback); |
| 48 ~SyncEngineForProfileSyncTest() override; | 48 ~SyncEngineForProfileSyncTest() override; |
| 49 | 49 |
| 50 void Initialize(InitParams params) override; | 50 void Initialize(InitParams params) override; |
| 51 | 51 |
| 52 void RequestConfigureSyncer( | 52 void ConfigureDataTypes(ConfigureParams params) override; |
| 53 syncer::ConfigureReason reason, | |
| 54 syncer::ModelTypeSet to_download, | |
| 55 const syncer::ModelSafeRoutingInfo& routing_info, | |
| 56 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>& | |
| 57 ready_task, | |
| 58 const base::Closure& retry_callback) override; | |
| 59 | 53 |
| 60 private: | 54 private: |
| 61 // Invoked at the start of HandleSyncManagerInitializationOnFrontendLoop. | 55 // Invoked at the start of HandleSyncManagerInitializationOnFrontendLoop. |
| 62 // Allows extra initialization work to be performed before the engine comes | 56 // Allows extra initialization work to be performed before the engine comes |
| 63 // up. | 57 // up. |
| 64 base::Closure callback_; | 58 base::Closure callback_; |
| 65 | 59 |
| 66 DISALLOW_COPY_AND_ASSIGN(SyncEngineForProfileSyncTest); | 60 DISALLOW_COPY_AND_ASSIGN(SyncEngineForProfileSyncTest); |
| 67 }; | 61 }; |
| 68 | 62 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 97 syncer::EngineComponentsFactory::Switches factory_switches = | 91 syncer::EngineComponentsFactory::Switches factory_switches = |
| 98 params.engine_components_factory->GetSwitches(); | 92 params.engine_components_factory->GetSwitches(); |
| 99 params.engine_components_factory = | 93 params.engine_components_factory = |
| 100 base::MakeUnique<syncer::TestEngineComponentsFactory>( | 94 base::MakeUnique<syncer::TestEngineComponentsFactory>( |
| 101 factory_switches, syncer::EngineComponentsFactory::STORAGE_IN_MEMORY, | 95 factory_switches, syncer::EngineComponentsFactory::STORAGE_IN_MEMORY, |
| 102 nullptr); | 96 nullptr); |
| 103 | 97 |
| 104 SyncBackendHostImpl::Initialize(std::move(params)); | 98 SyncBackendHostImpl::Initialize(std::move(params)); |
| 105 } | 99 } |
| 106 | 100 |
| 107 void SyncEngineForProfileSyncTest::RequestConfigureSyncer( | 101 void SyncEngineForProfileSyncTest::ConfigureDataTypes(ConfigureParams params) { |
| 108 syncer::ConfigureReason reason, | |
| 109 syncer::ModelTypeSet to_download, | |
| 110 const syncer::ModelSafeRoutingInfo& routing_info, | |
| 111 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>& | |
| 112 ready_task, | |
| 113 const base::Closure& retry_callback) { | |
| 114 syncer::ModelTypeSet failed_configuration_types; | |
| 115 | |
| 116 // The first parameter there should be the set of enabled types. That's not | 102 // The first parameter there should be the set of enabled types. That's not |
| 117 // something we have access to from this strange test harness. We'll just | 103 // something we have access to from this strange test harness. We'll just |
| 118 // send back the list of newly configured types instead and hope it doesn't | 104 // send back the list of newly configured types instead and hope it doesn't |
| 119 // break anything. | 105 // break anything. |
| 120 // Posted to avoid re-entrancy issues. | 106 // Posted to avoid re-entrancy issues. |
| 121 base::ThreadTaskRunnerHandle::Get()->PostTask( | 107 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 122 FROM_HERE, | 108 FROM_HERE, |
| 123 base::Bind( | 109 base::Bind( |
| 124 &SyncEngineForProfileSyncTest::FinishConfigureDataTypesOnFrontendLoop, | 110 &SyncEngineForProfileSyncTest::FinishConfigureDataTypesOnFrontendLoop, |
| 125 base::Unretained(this), | 111 base::Unretained(this), params.to_download, params.to_download, |
| 126 syncer::Difference(to_download, failed_configuration_types), | 112 syncer::ModelTypeSet(), params.ready_task)); |
| 127 syncer::Difference(to_download, failed_configuration_types), | |
| 128 failed_configuration_types, ready_task)); | |
| 129 } | 113 } |
| 130 | 114 |
| 131 // Helper function for return-type-upcasting of the callback. | 115 // Helper function for return-type-upcasting of the callback. |
| 132 syncer::SyncService* GetSyncService( | 116 syncer::SyncService* GetSyncService( |
| 133 base::Callback<TestProfileSyncService*(void)> get_sync_service_callback) { | 117 base::Callback<TestProfileSyncService*(void)> get_sync_service_callback) { |
| 134 return get_sync_service_callback.Run(); | 118 return get_sync_service_callback.Run(); |
| 135 } | 119 } |
| 136 | 120 |
| 137 } // namespace | 121 } // namespace |
| 138 | 122 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 204 |
| 221 bool CreateRootHelper::success() { | 205 bool CreateRootHelper::success() { |
| 222 return success_; | 206 return success_; |
| 223 } | 207 } |
| 224 | 208 |
| 225 void CreateRootHelper::CreateRootCallback() { | 209 void CreateRootHelper::CreateRootCallback() { |
| 226 success_ = test_->CreateRoot(model_type_); | 210 success_ = test_->CreateRoot(model_type_); |
| 227 } | 211 } |
| 228 | 212 |
| 229 } // namespace browser_sync | 213 } // namespace browser_sync |
| OLD | NEW |