Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: components/browser_sync/profile_sync_service_unittest.cc

Issue 2559123002: [Sync] SyncEngine refactor part 2: SyncServiceBase. (Closed)
Patch Set: Address comments. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/browser_sync/profile_sync_service.cc ('k') | components/sync/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/profile_sync_service.h" 5 #include "components/browser_sync/profile_sync_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 private: 97 private:
98 ProfileSyncService* service_; 98 ProfileSyncService* service_;
99 bool setup_in_progress_; 99 bool setup_in_progress_;
100 }; 100 };
101 101
102 // A variant of the FakeSyncEngine that won't automatically call back when asked 102 // A variant of the FakeSyncEngine that won't automatically call back when asked
103 // to initialized. Allows us to test things that could happen while backend init 103 // to initialized. Allows us to test things that could happen while backend init
104 // is in progress. 104 // is in progress.
105 class SyncEngineNoReturn : public FakeSyncEngine { 105 class SyncEngineNoReturn : public FakeSyncEngine {
106 void Initialize( 106 void Initialize(InitParams params) override {}
107 syncer::SyncEngineHost* host,
108 scoped_refptr<base::SingleThreadTaskRunner> sync_task_runner,
109 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
110 const GURL& service_url,
111 const std::string& sync_user_agent,
112 const syncer::SyncCredentials& credentials,
113 bool delete_sync_data_folder,
114 bool enable_local_sync_backend,
115 const base::FilePath& local_sync_backend_folder,
116 std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory,
117 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>&
118 unrecoverable_error_handler,
119 const base::Closure& report_unrecoverable_error_function,
120 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter,
121 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState>
122 saved_nigori_state) override {}
123 }; 107 };
124 108
125 class FakeSyncEngineCollectDeleteDirParam : public FakeSyncEngine { 109 class FakeSyncEngineCollectDeleteDirParam : public FakeSyncEngine {
126 public: 110 public:
127 explicit FakeSyncEngineCollectDeleteDirParam( 111 explicit FakeSyncEngineCollectDeleteDirParam(
128 std::vector<bool>* delete_dir_param) 112 std::vector<bool>* delete_dir_param)
129 : delete_dir_param_(delete_dir_param) {} 113 : delete_dir_param_(delete_dir_param) {}
130 114
131 void Initialize( 115 void Initialize(InitParams params) override {
132 syncer::SyncEngineHost* host, 116 delete_dir_param_->push_back(params.delete_sync_data_folder);
133 scoped_refptr<base::SingleThreadTaskRunner> sync_task_runner, 117 FakeSyncEngine::Initialize(std::move(params));
134 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
135 const GURL& service_url,
136 const std::string& sync_user_agent,
137 const syncer::SyncCredentials& credentials,
138 bool delete_sync_data_folder,
139 bool enable_local_sync_backend,
140 const base::FilePath& local_sync_backend_folder,
141 std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory,
142 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>&
143 unrecoverable_error_handler,
144 const base::Closure& report_unrecoverable_error_function,
145 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter,
146 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState>
147 saved_nigori_state) override {
148 delete_dir_param_->push_back(delete_sync_data_folder);
149 FakeSyncEngine::Initialize(
150 host, std::move(sync_task_runner), event_handler, service_url,
151 sync_user_agent, credentials, delete_sync_data_folder,
152 enable_local_sync_backend, local_sync_backend_folder,
153 std::move(sync_manager_factory), unrecoverable_error_handler,
154 report_unrecoverable_error_function, http_post_provider_factory_getter,
155 std::move(saved_nigori_state));
156 } 118 }
157 119
158 private: 120 private:
159 std::vector<bool>* delete_dir_param_; 121 std::vector<bool>* delete_dir_param_;
160 }; 122 };
161 123
162 // FakeSyncEngine that calls an external callback when ClearServerData is 124 // FakeSyncEngine that calls an external callback when ClearServerData is
163 // called. 125 // called.
164 class SyncEngineCaptureClearServerData : public FakeSyncEngine { 126 class SyncEngineCaptureClearServerData : public FakeSyncEngine {
165 public: 127 public:
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 // Progress the controller to RUNNING first, which is how the service 932 // Progress the controller to RUNNING first, which is how the service
971 // determines whether a type is enabled. 933 // determines whether a type is enabled.
972 controller->StartAssociating(base::Bind(&DoNothing)); 934 controller->StartAssociating(base::Bind(&DoNothing));
973 controller->FinishStart(DataTypeController::OK_FIRST_RUN); 935 controller->FinishStart(DataTypeController::OK_FIRST_RUN);
974 service()->RegisterDataTypeController(std::move(controller)); 936 service()->RegisterDataTypeController(std::move(controller));
975 EXPECT_NE(nullptr, service()->GetOpenTabsUIDelegate()); 937 EXPECT_NE(nullptr, service()->GetOpenTabsUIDelegate());
976 } 938 }
977 939
978 } // namespace 940 } // namespace
979 } // namespace browser_sync 941 } // namespace browser_sync
OLDNEW
« no previous file with comments | « components/browser_sync/profile_sync_service.cc ('k') | components/sync/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698