| 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 "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "sync/internal_api/public/http_post_provider_factory.h" | 8 #include "sync/internal_api/public/http_post_provider_factory.h" |
| 9 #include "sync/internal_api/public/internal_components_factory.h" | 9 #include "sync/internal_api/public/internal_components_factory.h" |
| 10 #include "sync/internal_api/public/util/weak_handle.h" | 10 #include "sync/internal_api/public/util/weak_handle.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool FakeSyncManager::Init( | 45 bool FakeSyncManager::Init( |
| 46 const FilePath& database_location, | 46 const FilePath& database_location, |
| 47 const WeakHandle<JsEventHandler>& event_handler, | 47 const WeakHandle<JsEventHandler>& event_handler, |
| 48 const std::string& sync_server_and_path, | 48 const std::string& sync_server_and_path, |
| 49 int sync_server_port, | 49 int sync_server_port, |
| 50 bool use_ssl, | 50 bool use_ssl, |
| 51 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 51 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
| 52 scoped_ptr<HttpPostProviderFactory> post_factory, | 52 scoped_ptr<HttpPostProviderFactory> post_factory, |
| 53 const ModelSafeRoutingInfo& model_safe_routing_info, | |
| 54 const std::vector<ModelSafeWorker*>& workers, | 53 const std::vector<ModelSafeWorker*>& workers, |
| 55 ExtensionsActivityMonitor* extensions_activity_monitor, | 54 ExtensionsActivityMonitor* extensions_activity_monitor, |
| 56 ChangeDelegate* change_delegate, | 55 ChangeDelegate* change_delegate, |
| 57 const SyncCredentials& credentials, | 56 const SyncCredentials& credentials, |
| 58 scoped_ptr<SyncNotifier> sync_notifier, | 57 scoped_ptr<SyncNotifier> sync_notifier, |
| 59 const std::string& restored_key_for_bootstrapping, | 58 const std::string& restored_key_for_bootstrapping, |
| 60 scoped_ptr<InternalComponentsFactory> internal_components_factory, | 59 scoped_ptr<InternalComponentsFactory> internal_components_factory, |
| 61 Encryptor* encryptor, | 60 Encryptor* encryptor, |
| 62 UnrecoverableErrorHandler* unrecoverable_error_handler, | 61 UnrecoverableErrorHandler* unrecoverable_error_handler, |
| 63 ReportUnrecoverableErrorFunction | 62 ReportUnrecoverableErrorFunction |
| 64 report_unrecoverable_error_function) { | 63 report_unrecoverable_error_function) { |
| 65 sync_loop_ = MessageLoop::current(); | 64 sync_loop_ = MessageLoop::current(); |
| 66 PurgePartiallySyncedTypes(); | 65 PurgePartiallySyncedTypes(); |
| 67 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 66 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 68 OnInitializationComplete( | 67 OnInitializationComplete( |
| 69 WeakHandle<JsBackend>(), | 68 syncer::WeakHandle<syncer::JsBackend>(), |
| 70 true)); | 69 true, initial_sync_ended_types_)); |
| 71 return true; | 70 return true; |
| 72 } | 71 } |
| 73 | 72 |
| 74 void FakeSyncManager::ThrowUnrecoverableError() { | 73 void FakeSyncManager::ThrowUnrecoverableError() { |
| 75 NOTIMPLEMENTED(); | 74 NOTIMPLEMENTED(); |
| 76 } | 75 } |
| 77 | 76 |
| 78 ModelTypeSet FakeSyncManager::InitialSyncEndedTypes() { | 77 ModelTypeSet FakeSyncManager::InitialSyncEndedTypes() { |
| 79 return initial_sync_ended_types_; | 78 return initial_sync_ended_types_; |
| 80 } | 79 } |
| 81 | 80 |
| 82 ModelTypeSet FakeSyncManager::GetTypesWithEmptyProgressMarkerToken( | 81 ModelTypeSet FakeSyncManager::GetTypesWithEmptyProgressMarkerToken( |
| 83 ModelTypeSet types) { | 82 ModelTypeSet types) { |
| 84 ModelTypeSet empty_types = types; | 83 ModelTypeSet empty_types = types; |
| 85 empty_types.RemoveAll(progress_marker_types_); | 84 empty_types.RemoveAll(progress_marker_types_); |
| 86 return empty_types; | 85 return empty_types; |
| 87 } | 86 } |
| 88 | 87 |
| 89 bool FakeSyncManager::PurgePartiallySyncedTypes() { | 88 bool FakeSyncManager::PurgePartiallySyncedTypes() { |
| 90 ModelTypeSet partial_types; | 89 ModelTypeSet partial_types; |
| 91 for (ModelTypeSet::Iterator i = progress_marker_types_.First(); | 90 for (ModelTypeSet::Iterator i = progress_marker_types_.First(); |
| 92 i.Good(); i.Inc()) { | 91 i.Good(); i.Inc()) { |
| 93 if (!initial_sync_ended_types_.Has(i.Get())) | 92 if (!initial_sync_ended_types_.Has(i.Get())) |
| 94 partial_types.Put(i.Get()); | 93 partial_types.Put(i.Get()); |
| 95 } | 94 } |
| 96 progress_marker_types_.RemoveAll(partial_types); | 95 progress_marker_types_.RemoveAll(partial_types); |
| 96 cleaned_types_.PutAll(partial_types); |
| 97 return true; | 97 return true; |
| 98 } | 98 } |
| 99 | 99 |
| 100 void FakeSyncManager::UpdateCredentials(const SyncCredentials& credentials) { | 100 void FakeSyncManager::UpdateCredentials(const SyncCredentials& credentials) { |
| 101 NOTIMPLEMENTED(); | 101 NOTIMPLEMENTED(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void FakeSyncManager::UpdateEnabledTypes(const ModelTypeSet& types) { | 104 void FakeSyncManager::UpdateEnabledTypes(const ModelTypeSet& types) { |
| 105 // Do nothing. | 105 // Do nothing. |
| 106 } | 106 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 return false; | 200 return false; |
| 201 } | 201 } |
| 202 | 202 |
| 203 bool FakeSyncManager::HasUnsyncedItems() { | 203 bool FakeSyncManager::HasUnsyncedItems() { |
| 204 NOTIMPLEMENTED(); | 204 NOTIMPLEMENTED(); |
| 205 return false; | 205 return false; |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace syncer | 208 } // namespace syncer |
| 209 | 209 |
| OLD | NEW |