| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_test_util.h" | 5 #include "components/browser_sync/profile_sync_test_util.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "components/bookmarks/browser/bookmark_model.h" | 12 #include "components/bookmarks/browser/bookmark_model.h" |
| 13 #include "components/history/core/browser/history_model_worker.h" | 13 #include "components/history/core/browser/history_model_worker.h" |
| 14 #include "components/history/core/browser/history_service.h" | 14 #include "components/history/core/browser/history_service.h" |
| 15 #include "components/pref_registry/pref_registry_syncable.h" | 15 #include "components/pref_registry/pref_registry_syncable.h" |
| 16 #include "components/signin/core/browser/signin_manager_base.h" | 16 #include "components/signin/core/browser/signin_manager_base.h" |
| 17 #include "components/sync/base/sync_prefs.h" | 17 #include "components/sync/base/sync_prefs.h" |
| 18 #include "components/sync/driver/signin_manager_wrapper.h" | 18 #include "components/sync/driver/signin_manager_wrapper.h" |
| 19 #include "components/sync/engine/browser_thread_model_worker.h" | |
| 20 #include "components/sync/engine/passive_model_worker.h" | 19 #include "components/sync/engine/passive_model_worker.h" |
| 20 #include "components/sync/engine/sequenced_model_worker.h" |
| 21 #include "components/sync/engine/ui_model_worker.h" | 21 #include "components/sync/engine/ui_model_worker.h" |
| 22 #include "net/url_request/url_request_test_util.h" | 22 #include "net/url_request/url_request_test_util.h" |
| 23 | 23 |
| 24 namespace browser_sync { | 24 namespace browser_sync { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 class BundleSyncClient : public syncer::FakeSyncClient { | 28 class BundleSyncClient : public syncer::FakeSyncClient { |
| 29 public: | 29 public: |
| 30 BundleSyncClient(syncer::SyncApiComponentFactory* factory, | 30 BundleSyncClient(syncer::SyncApiComponentFactory* factory, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return get_sync_service_callback_.Run(); | 123 return get_sync_service_callback_.Run(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 scoped_refptr<syncer::ModelSafeWorker> | 126 scoped_refptr<syncer::ModelSafeWorker> |
| 127 BundleSyncClient::CreateModelWorkerForGroup(syncer::ModelSafeGroup group) { | 127 BundleSyncClient::CreateModelWorkerForGroup(syncer::ModelSafeGroup group) { |
| 128 if (!db_thread_) | 128 if (!db_thread_) |
| 129 return FakeSyncClient::CreateModelWorkerForGroup(group); | 129 return FakeSyncClient::CreateModelWorkerForGroup(group); |
| 130 DCHECK(file_thread_) << "DB thread was specified but FILE thread was not."; | 130 DCHECK(file_thread_) << "DB thread was specified but FILE thread was not."; |
| 131 switch (group) { | 131 switch (group) { |
| 132 case syncer::GROUP_DB: | 132 case syncer::GROUP_DB: |
| 133 return new syncer::BrowserThreadModelWorker(db_thread_, syncer::GROUP_DB); | 133 return new syncer::SequencedModelWorker(db_thread_, syncer::GROUP_DB); |
| 134 case syncer::GROUP_FILE: | 134 case syncer::GROUP_FILE: |
| 135 return new syncer::BrowserThreadModelWorker(file_thread_, | 135 return new syncer::SequencedModelWorker(file_thread_, syncer::GROUP_FILE); |
| 136 syncer::GROUP_FILE); | |
| 137 case syncer::GROUP_UI: | 136 case syncer::GROUP_UI: |
| 138 return new syncer::UIModelWorker(base::ThreadTaskRunnerHandle::Get()); | 137 return new syncer::UIModelWorker(base::ThreadTaskRunnerHandle::Get()); |
| 139 case syncer::GROUP_PASSIVE: | 138 case syncer::GROUP_PASSIVE: |
| 140 return new syncer::PassiveModelWorker(); | 139 return new syncer::PassiveModelWorker(); |
| 141 case syncer::GROUP_HISTORY: { | 140 case syncer::GROUP_HISTORY: { |
| 142 history::HistoryService* history_service = GetHistoryService(); | 141 history::HistoryService* history_service = GetHistoryService(); |
| 143 if (!history_service) | 142 if (!history_service) |
| 144 return nullptr; | 143 return nullptr; |
| 145 return new HistoryModelWorker(history_service->AsWeakPtr(), | 144 return new HistoryModelWorker(history_service->AsWeakPtr(), |
| 146 base::ThreadTaskRunnerHandle::Get()); | 145 base::ThreadTaskRunnerHandle::Get()); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 base::Bind(&EmptyNetworkTimeUpdate); | 259 base::Bind(&EmptyNetworkTimeUpdate); |
| 261 init_params.base_directory = base::FilePath(FILE_PATH_LITERAL("dummyPath")); | 260 init_params.base_directory = base::FilePath(FILE_PATH_LITERAL("dummyPath")); |
| 262 init_params.url_request_context = url_request_context(); | 261 init_params.url_request_context = url_request_context(); |
| 263 init_params.debug_identifier = "dummyDebugName"; | 262 init_params.debug_identifier = "dummyDebugName"; |
| 264 init_params.channel = version_info::Channel::UNKNOWN; | 263 init_params.channel = version_info::Channel::UNKNOWN; |
| 265 | 264 |
| 266 return init_params; | 265 return init_params; |
| 267 } | 266 } |
| 268 | 267 |
| 269 } // namespace browser_sync | 268 } // namespace browser_sync |
| OLD | NEW |