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 "sync/internal_api/public/test/fake_sync_manager.h" | 5 #include "sync/internal_api/public/test/fake_sync_manager.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void FakeSyncManager::DisableNotifications( | 77 void FakeSyncManager::DisableNotifications( |
78 NotificationsDisabledReason reason) { | 78 NotificationsDisabledReason reason) { |
79 if (!sync_task_runner_->PostTask( | 79 if (!sync_task_runner_->PostTask( |
80 FROM_HERE, | 80 FROM_HERE, |
81 base::Bind(&FakeSyncManager::DisableNotificationsOnSyncThread, | 81 base::Bind(&FakeSyncManager::DisableNotificationsOnSyncThread, |
82 base::Unretained(this), reason))) { | 82 base::Unretained(this), reason))) { |
83 NOTREACHED(); | 83 NOTREACHED(); |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 bool FakeSyncManager::Init( | 87 void FakeSyncManager::Init( |
88 const FilePath& database_location, | 88 const FilePath& database_location, |
89 const WeakHandle<JsEventHandler>& event_handler, | 89 const WeakHandle<JsEventHandler>& event_handler, |
90 const std::string& sync_server_and_path, | 90 const std::string& sync_server_and_path, |
91 int sync_server_port, | 91 int sync_server_port, |
92 bool use_ssl, | 92 bool use_ssl, |
93 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 93 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
94 scoped_ptr<HttpPostProviderFactory> post_factory, | 94 scoped_ptr<HttpPostProviderFactory> post_factory, |
95 const std::vector<ModelSafeWorker*>& workers, | 95 const std::vector<ModelSafeWorker*>& workers, |
96 ExtensionsActivityMonitor* extensions_activity_monitor, | 96 ExtensionsActivityMonitor* extensions_activity_monitor, |
97 ChangeDelegate* change_delegate, | 97 ChangeDelegate* change_delegate, |
98 const SyncCredentials& credentials, | 98 const SyncCredentials& credentials, |
99 scoped_ptr<SyncNotifier> sync_notifier, | 99 scoped_ptr<SyncNotifier> sync_notifier, |
100 const std::string& restored_key_for_bootstrapping, | 100 const std::string& restored_key_for_bootstrapping, |
101 const std::string& restored_keystore_key_for_bootstrapping, | 101 const std::string& restored_keystore_key_for_bootstrapping, |
102 bool keystore_encryption_enabled, | 102 bool keystore_encryption_enabled, |
103 scoped_ptr<InternalComponentsFactory> internal_components_factory, | 103 scoped_ptr<InternalComponentsFactory> internal_components_factory, |
104 Encryptor* encryptor, | 104 Encryptor* encryptor, |
105 UnrecoverableErrorHandler* unrecoverable_error_handler, | 105 UnrecoverableErrorHandler* unrecoverable_error_handler, |
106 ReportUnrecoverableErrorFunction | 106 ReportUnrecoverableErrorFunction |
107 report_unrecoverable_error_function) { | 107 report_unrecoverable_error_function) { |
108 sync_task_runner_ = base::ThreadTaskRunnerHandle::Get(); | 108 sync_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
109 PurgePartiallySyncedTypes(); | 109 PurgePartiallySyncedTypes(); |
110 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 110 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
111 OnInitializationComplete( | 111 OnInitializationComplete( |
112 syncer::WeakHandle<syncer::JsBackend>(), | 112 syncer::WeakHandle<syncer::JsBackend>(), |
113 true, initial_sync_ended_types_)); | 113 true, initial_sync_ended_types_)); |
114 return true; | |
115 } | 114 } |
116 | 115 |
117 void FakeSyncManager::ThrowUnrecoverableError() { | 116 void FakeSyncManager::ThrowUnrecoverableError() { |
118 NOTIMPLEMENTED(); | 117 NOTIMPLEMENTED(); |
119 } | 118 } |
120 | 119 |
121 ModelTypeSet FakeSyncManager::InitialSyncEndedTypes() { | 120 ModelTypeSet FakeSyncManager::InitialSyncEndedTypes() { |
122 return initial_sync_ended_types_; | 121 return initial_sync_ended_types_; |
123 } | 122 } |
124 | 123 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 notifier_helper_.EmitOnNotificationsEnabled(); | 272 notifier_helper_.EmitOnNotificationsEnabled(); |
274 } | 273 } |
275 | 274 |
276 void FakeSyncManager::DisableNotificationsOnSyncThread( | 275 void FakeSyncManager::DisableNotificationsOnSyncThread( |
277 NotificationsDisabledReason reason) { | 276 NotificationsDisabledReason reason) { |
278 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); | 277 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); |
279 notifier_helper_.EmitOnNotificationsDisabled(reason); | 278 notifier_helper_.EmitOnNotificationsDisabled(reason); |
280 } | 279 } |
281 | 280 |
282 } // namespace syncer | 281 } // namespace syncer |
OLD | NEW |