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