OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/gcm_driver/fake_gcm_client.h" | 5 #include "components/gcm_driver/fake_gcm_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 void FakeGCMClient::Send(const std::string& app_id, | 151 void FakeGCMClient::Send(const std::string& app_id, |
152 const std::string& receiver_id, | 152 const std::string& receiver_id, |
153 const OutgoingMessage& message) { | 153 const OutgoingMessage& message) { |
154 DCHECK(io_thread_->RunsTasksOnCurrentThread()); | 154 DCHECK(io_thread_->RunsTasksOnCurrentThread()); |
155 | 155 |
156 base::ThreadTaskRunnerHandle::Get()->PostTask( | 156 base::ThreadTaskRunnerHandle::Get()->PostTask( |
157 FROM_HERE, base::Bind(&FakeGCMClient::SendFinished, | 157 FROM_HERE, base::Bind(&FakeGCMClient::SendFinished, |
158 weak_ptr_factory_.GetWeakPtr(), app_id, message)); | 158 weak_ptr_factory_.GetWeakPtr(), app_id, message)); |
159 } | 159 } |
160 | 160 |
| 161 void FakeGCMClient::RecordDecryptionFailure( |
| 162 const std::string& app_id, |
| 163 GCMEncryptionProvider::DecryptionFailure reason) { |
| 164 recorder_.RecordDecryptionFailure(app_id, reason); |
| 165 } |
| 166 |
161 void FakeGCMClient::SetRecording(bool recording) { | 167 void FakeGCMClient::SetRecording(bool recording) { |
| 168 recorder_.set_is_recording(recording); |
162 } | 169 } |
163 | 170 |
164 void FakeGCMClient::ClearActivityLogs() { | 171 void FakeGCMClient::ClearActivityLogs() { |
| 172 recorder_.Clear(); |
165 } | 173 } |
166 | 174 |
167 GCMClient::GCMStatistics FakeGCMClient::GetStatistics() const { | 175 GCMClient::GCMStatistics FakeGCMClient::GetStatistics() const { |
168 return GCMClient::GCMStatistics(); | 176 GCMClient::GCMStatistics statistics; |
| 177 statistics.is_recording = recorder_.is_recording(); |
| 178 |
| 179 recorder_.CollectActivities(&statistics.recorded_activities); |
| 180 return statistics; |
169 } | 181 } |
170 | 182 |
171 void FakeGCMClient::SetAccountTokens( | 183 void FakeGCMClient::SetAccountTokens( |
172 const std::vector<AccountTokenInfo>& account_tokens) { | 184 const std::vector<AccountTokenInfo>& account_tokens) { |
173 } | 185 } |
174 | 186 |
175 void FakeGCMClient::UpdateAccountMapping( | 187 void FakeGCMClient::UpdateAccountMapping( |
176 const AccountMapping& account_mapping) { | 188 const AccountMapping& account_mapping) { |
177 } | 189 } |
178 | 190 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 delegate_->OnMessageSendError(app_id, send_error_details); | 319 delegate_->OnMessageSendError(app_id, send_error_details); |
308 } | 320 } |
309 | 321 |
310 void FakeGCMClient::SendAcknowledgement(const std::string& app_id, | 322 void FakeGCMClient::SendAcknowledgement(const std::string& app_id, |
311 const std::string& message_id) { | 323 const std::string& message_id) { |
312 if (delegate_) | 324 if (delegate_) |
313 delegate_->OnSendAcknowledged(app_id, message_id); | 325 delegate_->OnSendAcknowledged(app_id, message_id); |
314 } | 326 } |
315 | 327 |
316 } // namespace gcm | 328 } // namespace gcm |
OLD | NEW |