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

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

Issue 442123003: [GCM] Adding the OnSendAcknowledgement event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing code review comments. Created 6 years, 4 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 | « components/gcm_driver/fake_gcm_app_handler.h ('k') | components/gcm_driver/fake_gcm_client.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/fake_gcm_app_handler.h" 5 #include "components/gcm_driver/fake_gcm_app_handler.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 8
9 namespace gcm { 9 namespace gcm {
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 const std::string& app_id, 46 const std::string& app_id,
47 const GCMClient::SendErrorDetails& send_error_details) { 47 const GCMClient::SendErrorDetails& send_error_details) {
48 ClearResults(); 48 ClearResults();
49 received_event_ = SEND_ERROR_EVENT; 49 received_event_ = SEND_ERROR_EVENT;
50 app_id_ = app_id; 50 app_id_ = app_id;
51 send_error_details_ = send_error_details; 51 send_error_details_ = send_error_details;
52 if (run_loop_) 52 if (run_loop_)
53 run_loop_->Quit(); 53 run_loop_->Quit();
54 } 54 }
55 55
56 void FakeGCMAppHandler::OnSendAcknowledged(
57 const std::string& app_id,
58 const std::string& message_id) {
59 ClearResults();
60 app_id_ = app_id;
61 acked_message_id_ = message_id;
62 if (run_loop_)
63 run_loop_->Quit();
64 }
65
56 void FakeGCMAppHandler::ClearResults() { 66 void FakeGCMAppHandler::ClearResults() {
57 received_event_ = NO_EVENT; 67 received_event_ = NO_EVENT;
58 app_id_.clear(); 68 app_id_.clear();
69 acked_message_id_.clear();
59 message_ = GCMClient::IncomingMessage(); 70 message_ = GCMClient::IncomingMessage();
60 send_error_details_ = GCMClient::SendErrorDetails(); 71 send_error_details_ = GCMClient::SendErrorDetails();
61 } 72 }
62 73
63 void FakeGCMAppHandler::OnConnected(const net::IPEndPoint& ip_endpoint) { 74 void FakeGCMAppHandler::OnConnected(const net::IPEndPoint& ip_endpoint) {
64 connected_ = true; 75 connected_ = true;
65 } 76 }
66 77
67 void FakeGCMAppHandler::OnDisconnected() { 78 void FakeGCMAppHandler::OnDisconnected() {
68 connected_ = false; 79 connected_ = false;
69 } 80 }
70 81
71 } // namespace gcm 82 } // namespace gcm
OLDNEW
« no previous file with comments | « components/gcm_driver/fake_gcm_app_handler.h ('k') | components/gcm_driver/fake_gcm_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698