| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 const std::vector<AccountTokenInfo>& account_tokens) { | 123 const std::vector<AccountTokenInfo>& account_tokens) { |
| 124 } | 124 } |
| 125 | 125 |
| 126 void FakeGCMClient::UpdateAccountMapping( | 126 void FakeGCMClient::UpdateAccountMapping( |
| 127 const AccountMapping& account_mapping) { | 127 const AccountMapping& account_mapping) { |
| 128 } | 128 } |
| 129 | 129 |
| 130 void FakeGCMClient::RemoveAccountMapping(const std::string& account_id) { | 130 void FakeGCMClient::RemoveAccountMapping(const std::string& account_id) { |
| 131 } | 131 } |
| 132 | 132 |
| 133 void FakeGCMClient::SetLastTokenFetchingTime(const base::Time& time) { |
| 134 } |
| 135 |
| 133 void FakeGCMClient::PerformDelayedLoading() { | 136 void FakeGCMClient::PerformDelayedLoading() { |
| 134 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); | 137 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); |
| 135 | 138 |
| 136 io_thread_->PostTask( | 139 io_thread_->PostTask( |
| 137 FROM_HERE, | 140 FROM_HERE, |
| 138 base::Bind(&FakeGCMClient::DoLoading, weak_ptr_factory_.GetWeakPtr())); | 141 base::Bind(&FakeGCMClient::DoLoading, weak_ptr_factory_.GetWeakPtr())); |
| 139 } | 142 } |
| 140 | 143 |
| 141 void FakeGCMClient::ReceiveMessage(const std::string& app_id, | 144 void FakeGCMClient::ReceiveMessage(const std::string& app_id, |
| 142 const IncomingMessage& message) { | 145 const IncomingMessage& message) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 if (i > 0) | 179 if (i > 0) |
| 177 registration_id += ","; | 180 registration_id += ","; |
| 178 registration_id += normalized_sender_ids[i]; | 181 registration_id += normalized_sender_ids[i]; |
| 179 } | 182 } |
| 180 registration_id += base::IntToString(sequence_id_); | 183 registration_id += base::IntToString(sequence_id_); |
| 181 } | 184 } |
| 182 return registration_id; | 185 return registration_id; |
| 183 } | 186 } |
| 184 | 187 |
| 185 void FakeGCMClient::CheckinFinished() { | 188 void FakeGCMClient::CheckinFinished() { |
| 186 delegate_->OnGCMReady(std::vector<AccountMapping>()); | 189 delegate_->OnGCMReady(std::vector<AccountMapping>(), base::Time()); |
| 187 delegate_->OnConnected(net::IPEndPoint()); | 190 delegate_->OnConnected(net::IPEndPoint()); |
| 188 } | 191 } |
| 189 | 192 |
| 190 void FakeGCMClient::RegisterFinished(const std::string& app_id, | 193 void FakeGCMClient::RegisterFinished(const std::string& app_id, |
| 191 const std::string& registrion_id) { | 194 const std::string& registrion_id) { |
| 192 delegate_->OnRegisterFinished( | 195 delegate_->OnRegisterFinished( |
| 193 app_id, registrion_id, registrion_id.empty() ? SERVER_ERROR : SUCCESS); | 196 app_id, registrion_id, registrion_id.empty() ? SERVER_ERROR : SUCCESS); |
| 194 } | 197 } |
| 195 | 198 |
| 196 void FakeGCMClient::UnregisterFinished(const std::string& app_id) { | 199 void FakeGCMClient::UnregisterFinished(const std::string& app_id) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 delegate_->OnMessageSendError(app_id, send_error_details); | 247 delegate_->OnMessageSendError(app_id, send_error_details); |
| 245 } | 248 } |
| 246 | 249 |
| 247 void FakeGCMClient::SendAcknowledgement(const std::string& app_id, | 250 void FakeGCMClient::SendAcknowledgement(const std::string& app_id, |
| 248 const std::string& message_id) { | 251 const std::string& message_id) { |
| 249 if (delegate_) | 252 if (delegate_) |
| 250 delegate_->OnSendAcknowledged(app_id, message_id); | 253 delegate_->OnSendAcknowledged(app_id, message_id); |
| 251 } | 254 } |
| 252 | 255 |
| 253 } // namespace gcm | 256 } // namespace gcm |
| OLD | NEW |