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

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

Powered by Google App Engine
This is Rietveld 408576698