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

Side by Side Diff: components/gcm_driver/gcm_client_impl_unittest.cc

Issue 600053002: [GCM] Loading the account mappings from store to the driver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing account mapper from BUILD.gn android section Created 6 years, 3 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
« no previous file with comments | « components/gcm_driver/gcm_client_impl.cc ('k') | components/gcm_driver/gcm_driver_desktop.h » ('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 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/gcm_client_impl.h" 5 #include "components/gcm_driver/gcm_client_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 GCMClient::Result result) OVERRIDE {} 251 GCMClient::Result result) OVERRIDE {}
252 virtual void OnMessageReceived(const std::string& registration_id, 252 virtual void OnMessageReceived(const std::string& registration_id,
253 const GCMClient::IncomingMessage& message) 253 const GCMClient::IncomingMessage& message)
254 OVERRIDE; 254 OVERRIDE;
255 virtual void OnMessagesDeleted(const std::string& app_id) OVERRIDE; 255 virtual void OnMessagesDeleted(const std::string& app_id) OVERRIDE;
256 virtual void OnMessageSendError( 256 virtual void OnMessageSendError(
257 const std::string& app_id, 257 const std::string& app_id,
258 const gcm::GCMClient::SendErrorDetails& send_error_details) OVERRIDE; 258 const gcm::GCMClient::SendErrorDetails& send_error_details) OVERRIDE;
259 virtual void OnSendAcknowledged(const std::string& app_id, 259 virtual void OnSendAcknowledged(const std::string& app_id,
260 const std::string& message_id) OVERRIDE; 260 const std::string& message_id) OVERRIDE;
261 virtual void OnGCMReady() OVERRIDE; 261 virtual void OnGCMReady(
262 const std::vector<AccountMapping>& account_mappings) OVERRIDE;
262 virtual void OnActivityRecorded() OVERRIDE {} 263 virtual void OnActivityRecorded() OVERRIDE {}
263 virtual void OnConnected(const net::IPEndPoint& ip_endpoint) OVERRIDE {} 264 virtual void OnConnected(const net::IPEndPoint& ip_endpoint) OVERRIDE {}
264 virtual void OnDisconnected() OVERRIDE {} 265 virtual void OnDisconnected() OVERRIDE {}
265 266
266 GCMClientImpl* gcm_client() const { return gcm_client_.get(); } 267 GCMClientImpl* gcm_client() const { return gcm_client_.get(); }
267 FakeMCSClient* mcs_client() const { 268 FakeMCSClient* mcs_client() const {
268 return reinterpret_cast<FakeMCSClient*>(gcm_client_->mcs_client_.get()); 269 return reinterpret_cast<FakeMCSClient*>(gcm_client_->mcs_client_.get());
269 } 270 }
270 ConnectionFactory* connection_factory() const { 271 ConnectionFactory* connection_factory() const {
271 return gcm_client_->connection_factory_.get(); 272 return gcm_client_->connection_factory_.get();
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 gcm_client_->OnMessageReceivedFromMCS(message); 484 gcm_client_->OnMessageReceivedFromMCS(message);
484 } 485 }
485 486
486 void GCMClientImplTest::ReceiveOnMessageSentToMCS( 487 void GCMClientImplTest::ReceiveOnMessageSentToMCS(
487 const std::string& app_id, 488 const std::string& app_id,
488 const std::string& message_id, 489 const std::string& message_id,
489 const MCSClient::MessageSendStatus status) { 490 const MCSClient::MessageSendStatus status) {
490 gcm_client_->OnMessageSentToMCS(0LL, app_id, message_id, status); 491 gcm_client_->OnMessageSentToMCS(0LL, app_id, message_id, status);
491 } 492 }
492 493
493 void GCMClientImplTest::OnGCMReady() { 494 void GCMClientImplTest::OnGCMReady(
495 const std::vector<AccountMapping>& account_mappings) {
494 last_event_ = LOADING_COMPLETED; 496 last_event_ = LOADING_COMPLETED;
495 QuitLoop(); 497 QuitLoop();
498 // TODO(fgorski): Add scenario verifying contents of account_mappings, when
499 // the list is not empty.
496 } 500 }
497 501
498 void GCMClientImplTest::OnMessageReceived( 502 void GCMClientImplTest::OnMessageReceived(
499 const std::string& registration_id, 503 const std::string& registration_id,
500 const GCMClient::IncomingMessage& message) { 504 const GCMClient::IncomingMessage& message) {
501 last_event_ = MESSAGE_RECEIVED; 505 last_event_ = MESSAGE_RECEIVED;
502 last_app_id_ = registration_id; 506 last_app_id_ = registration_id;
503 last_message_ = message; 507 last_message_ = message;
504 QuitLoop(); 508 QuitLoop();
505 } 509 }
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 TEST_F(GCMClientImplStartAndStopTest, StartStopAndRestartImmediately) { 1002 TEST_F(GCMClientImplStartAndStopTest, StartStopAndRestartImmediately) {
999 // Start the GCM and then stop and restart it immediately. 1003 // Start the GCM and then stop and restart it immediately.
1000 gcm_client()->Start(); 1004 gcm_client()->Start();
1001 gcm_client()->Stop(); 1005 gcm_client()->Stop();
1002 gcm_client()->Start(); 1006 gcm_client()->Start();
1003 1007
1004 PumpLoopUntilIdle(); 1008 PumpLoopUntilIdle();
1005 } 1009 }
1006 1010
1007 } // namespace gcm 1011 } // namespace gcm
OLDNEW
« no previous file with comments | « components/gcm_driver/gcm_client_impl.cc ('k') | components/gcm_driver/gcm_driver_desktop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698