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

Side by Side Diff: sync/internal_api/test/fake_sync_manager.cc

Issue 10795018: [Sync] Remove unneeded 'using syncer::' lines and 'syncer::' scopings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indent Created 8 years, 5 months 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 | Annotate | Revision Log
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 "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/util/weak_handle.h" 9 #include "sync/internal_api/public/util/weak_handle.h"
10 #include "sync/notifier/sync_notifier.h" 10 #include "sync/notifier/sync_notifier.h"
11 11
12 namespace syncer { 12 namespace syncer {
13 13
14 FakeSyncManager::FakeSyncManager() { 14 FakeSyncManager::FakeSyncManager() {
15 } 15 }
16 16
17 FakeSyncManager::~FakeSyncManager() { 17 FakeSyncManager::~FakeSyncManager() {
18 } 18 }
19 19
20 void FakeSyncManager::set_initial_sync_ended_types( 20 void FakeSyncManager::set_initial_sync_ended_types(ModelTypeSet types) {
21 syncer::ModelTypeSet types) {
22 initial_sync_ended_types_ = types; 21 initial_sync_ended_types_ = types;
23 } 22 }
24 23
25 void FakeSyncManager::set_progress_marker_types( 24 void FakeSyncManager::set_progress_marker_types(ModelTypeSet types) {
26 syncer::ModelTypeSet types) {
27 progress_marker_types_ = types; 25 progress_marker_types_ = types;
28 } 26 }
29 27
30 void FakeSyncManager::set_configure_fail_types(syncer::ModelTypeSet types) { 28 void FakeSyncManager::set_configure_fail_types(ModelTypeSet types) {
31 configure_fail_types_ = types; 29 configure_fail_types_ = types;
32 } 30 }
33 31
34 syncer::ModelTypeSet FakeSyncManager::GetAndResetCleanedTypes() { 32 ModelTypeSet FakeSyncManager::GetAndResetCleanedTypes() {
35 syncer::ModelTypeSet cleaned_types = cleaned_types_; 33 ModelTypeSet cleaned_types = cleaned_types_;
36 cleaned_types_.Clear(); 34 cleaned_types_.Clear();
37 return cleaned_types; 35 return cleaned_types;
38 } 36 }
39 37
40 syncer::ModelTypeSet FakeSyncManager::GetAndResetDownloadedTypes() { 38 ModelTypeSet FakeSyncManager::GetAndResetDownloadedTypes() {
41 syncer::ModelTypeSet downloaded_types = downloaded_types_; 39 ModelTypeSet downloaded_types = downloaded_types_;
42 downloaded_types_.Clear(); 40 downloaded_types_.Clear();
43 return downloaded_types; 41 return downloaded_types;
44 } 42 }
45 43
46 bool FakeSyncManager::Init( 44 bool FakeSyncManager::Init(
47 const FilePath& database_location, 45 const FilePath& database_location,
48 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, 46 const WeakHandle<JsEventHandler>& event_handler,
49 const std::string& sync_server_and_path, 47 const std::string& sync_server_and_path,
50 int sync_server_port, 48 int sync_server_port,
51 bool use_ssl, 49 bool use_ssl,
52 const scoped_refptr<base::TaskRunner>& blocking_task_runner, 50 const scoped_refptr<base::TaskRunner>& blocking_task_runner,
53 scoped_ptr<HttpPostProviderFactory> post_factory, 51 scoped_ptr<HttpPostProviderFactory> post_factory,
54 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, 52 const ModelSafeRoutingInfo& model_safe_routing_info,
55 const std::vector<syncer::ModelSafeWorker*>& workers, 53 const std::vector<ModelSafeWorker*>& workers,
56 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, 54 ExtensionsActivityMonitor* extensions_activity_monitor,
57 ChangeDelegate* change_delegate, 55 ChangeDelegate* change_delegate,
58 const SyncCredentials& credentials, 56 const SyncCredentials& credentials,
59 scoped_ptr<syncer::SyncNotifier> sync_notifier, 57 scoped_ptr<SyncNotifier> sync_notifier,
60 const std::string& restored_key_for_bootstrapping, 58 const std::string& restored_key_for_bootstrapping,
61 TestingMode testing_mode, 59 TestingMode testing_mode,
62 syncer::Encryptor* encryptor, 60 Encryptor* encryptor,
63 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, 61 UnrecoverableErrorHandler* unrecoverable_error_handler,
64 syncer::ReportUnrecoverableErrorFunction 62 ReportUnrecoverableErrorFunction
65 report_unrecoverable_error_function) { 63 report_unrecoverable_error_function) {
66 sync_loop_ = MessageLoop::current(); 64 sync_loop_ = MessageLoop::current();
67 PurgePartiallySyncedTypes(); 65 PurgePartiallySyncedTypes();
68 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, 66 FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
69 OnInitializationComplete( 67 OnInitializationComplete(
70 syncer::WeakHandle<syncer::JsBackend>(), 68 WeakHandle<JsBackend>(),
71 true)); 69 true));
72 return true; 70 return true;
73 } 71 }
74 72
75 void FakeSyncManager::ThrowUnrecoverableError() { 73 void FakeSyncManager::ThrowUnrecoverableError() {
76 NOTIMPLEMENTED(); 74 NOTIMPLEMENTED();
77 } 75 }
78 76
79 syncer::ModelTypeSet FakeSyncManager::InitialSyncEndedTypes() { 77 ModelTypeSet FakeSyncManager::InitialSyncEndedTypes() {
80 return initial_sync_ended_types_; 78 return initial_sync_ended_types_;
81 } 79 }
82 80
83 syncer::ModelTypeSet FakeSyncManager::GetTypesWithEmptyProgressMarkerToken( 81 ModelTypeSet FakeSyncManager::GetTypesWithEmptyProgressMarkerToken(
84 syncer::ModelTypeSet types) { 82 ModelTypeSet types) {
85 syncer::ModelTypeSet empty_types = types; 83 ModelTypeSet empty_types = types;
86 empty_types.RemoveAll(progress_marker_types_); 84 empty_types.RemoveAll(progress_marker_types_);
87 return empty_types; 85 return empty_types;
88 } 86 }
89 87
90 bool FakeSyncManager::PurgePartiallySyncedTypes() { 88 bool FakeSyncManager::PurgePartiallySyncedTypes() {
91 ModelTypeSet partial_types; 89 ModelTypeSet partial_types;
92 for (syncer::ModelTypeSet::Iterator i = progress_marker_types_.First(); 90 for (ModelTypeSet::Iterator i = progress_marker_types_.First();
93 i.Good(); i.Inc()) { 91 i.Good(); i.Inc()) {
94 if (!initial_sync_ended_types_.Has(i.Get())) 92 if (!initial_sync_ended_types_.Has(i.Get()))
95 partial_types.Put(i.Get()); 93 partial_types.Put(i.Get());
96 } 94 }
97 progress_marker_types_.RemoveAll(partial_types); 95 progress_marker_types_.RemoveAll(partial_types);
98 return true; 96 return true;
99 } 97 }
100 98
101 void FakeSyncManager::UpdateCredentials(const SyncCredentials& credentials) { 99 void FakeSyncManager::UpdateCredentials(const SyncCredentials& credentials) {
102 NOTIMPLEMENTED(); 100 NOTIMPLEMENTED();
103 } 101 }
104 102
105 void FakeSyncManager::UpdateEnabledTypes(const syncer::ModelTypeSet& types) { 103 void FakeSyncManager::UpdateEnabledTypes(const ModelTypeSet& types) {
106 // Do nothing. 104 // Do nothing.
107 } 105 }
108 106
109 void FakeSyncManager::StartSyncingNormally( 107 void FakeSyncManager::StartSyncingNormally(
110 const syncer::ModelSafeRoutingInfo& routing_info) { 108 const ModelSafeRoutingInfo& routing_info) {
111 // Do nothing. 109 // Do nothing.
112 } 110 }
113 111
114 void FakeSyncManager::SetEncryptionPassphrase(const std::string& passphrase, 112 void FakeSyncManager::SetEncryptionPassphrase(const std::string& passphrase,
115 bool is_explicit) { 113 bool is_explicit) {
116 NOTIMPLEMENTED(); 114 NOTIMPLEMENTED();
117 } 115 }
118 116
119 void FakeSyncManager::SetDecryptionPassphrase(const std::string& passphrase) { 117 void FakeSyncManager::SetDecryptionPassphrase(const std::string& passphrase) {
120 NOTIMPLEMENTED(); 118 NOTIMPLEMENTED();
121 } 119 }
122 120
123 void FakeSyncManager::ConfigureSyncer( 121 void FakeSyncManager::ConfigureSyncer(
124 ConfigureReason reason, 122 ConfigureReason reason,
125 const syncer::ModelTypeSet& types_to_config, 123 const ModelTypeSet& types_to_config,
126 const syncer::ModelSafeRoutingInfo& new_routing_info, 124 const ModelSafeRoutingInfo& new_routing_info,
127 const base::Closure& ready_task, 125 const base::Closure& ready_task,
128 const base::Closure& retry_task) { 126 const base::Closure& retry_task) {
129 syncer::ModelTypeSet enabled_types = GetRoutingInfoTypes(new_routing_info); 127 ModelTypeSet enabled_types = GetRoutingInfoTypes(new_routing_info);
130 syncer::ModelTypeSet disabled_types = Difference( 128 ModelTypeSet disabled_types = Difference(
131 syncer::ModelTypeSet::All(), enabled_types); 129 ModelTypeSet::All(), enabled_types);
132 syncer::ModelTypeSet success_types = types_to_config; 130 ModelTypeSet success_types = types_to_config;
133 success_types.RemoveAll(configure_fail_types_); 131 success_types.RemoveAll(configure_fail_types_);
134 132
135 DVLOG(1) << "Faking configuration. Downloading: " 133 DVLOG(1) << "Faking configuration. Downloading: "
136 << syncer::ModelTypeSetToString(success_types) << ". Cleaning: " 134 << ModelTypeSetToString(success_types) << ". Cleaning: "
137 << syncer::ModelTypeSetToString(disabled_types); 135 << ModelTypeSetToString(disabled_types);
138 136
139 // Simulate cleaning up disabled types. 137 // Simulate cleaning up disabled types.
140 // TODO(sync): consider only cleaning those types that were recently disabled, 138 // TODO(sync): consider only cleaning those types that were recently disabled,
141 // if this isn't the first cleanup, which more accurately reflects the 139 // if this isn't the first cleanup, which more accurately reflects the
142 // behavior of the real cleanup logic. 140 // behavior of the real cleanup logic.
143 initial_sync_ended_types_.RemoveAll(disabled_types); 141 initial_sync_ended_types_.RemoveAll(disabled_types);
144 progress_marker_types_.RemoveAll(disabled_types); 142 progress_marker_types_.RemoveAll(disabled_types);
145 cleaned_types_.PutAll(disabled_types); 143 cleaned_types_.PutAll(disabled_types);
146 144
147 // Now simulate the actual configuration for those types that successfully 145 // Now simulate the actual configuration for those types that successfully
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 188
191 void FakeSyncManager::RefreshNigori(const std::string& chrome_version, 189 void FakeSyncManager::RefreshNigori(const std::string& chrome_version,
192 const base::Closure& done_callback) { 190 const base::Closure& done_callback) {
193 done_callback.Run(); 191 done_callback.Run();
194 } 192 }
195 193
196 void FakeSyncManager::EnableEncryptEverything() { 194 void FakeSyncManager::EnableEncryptEverything() {
197 NOTIMPLEMENTED(); 195 NOTIMPLEMENTED();
198 } 196 }
199 197
200 bool FakeSyncManager::ReceivedExperiment( 198 bool FakeSyncManager::ReceivedExperiment(Experiments* experiments) const {
201 syncer::Experiments* experiments) const {
202 return false; 199 return false;
203 } 200 }
204 201
205 bool FakeSyncManager::HasUnsyncedItems() const { 202 bool FakeSyncManager::HasUnsyncedItems() const {
206 NOTIMPLEMENTED(); 203 NOTIMPLEMENTED();
207 return false; 204 return false;
208 } 205 }
209 206
210 } // namespace syncer 207 } // namespace syncer
211 208
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698