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
3 // found in the LICENSE file.
5 #include "components/gcm_driver/fake_gcm_app_handler.h"
7 #include "base/run_loop.h"
11 FakeGCMAppHandler::FakeGCMAppHandler()
12 : received_event_(NO_EVENT
), connected_(false) {
15 FakeGCMAppHandler::~FakeGCMAppHandler() {
18 void FakeGCMAppHandler::WaitForNotification() {
19 run_loop_
.reset(new base::RunLoop
);
24 void FakeGCMAppHandler::ShutdownHandler() {
27 void FakeGCMAppHandler::OnMessage(const std::string
& app_id
,
28 const GCMClient::IncomingMessage
& message
) {
30 received_event_
= MESSAGE_EVENT
;
37 void FakeGCMAppHandler::OnMessagesDeleted(const std::string
& app_id
) {
39 received_event_
= MESSAGES_DELETED_EVENT
;
45 void FakeGCMAppHandler::OnSendError(
46 const std::string
& app_id
,
47 const GCMClient::SendErrorDetails
& send_error_details
) {
49 received_event_
= SEND_ERROR_EVENT
;
51 send_error_details_
= send_error_details
;
56 void FakeGCMAppHandler::ClearResults() {
57 received_event_
= NO_EVENT
;
59 message_
= GCMClient::IncomingMessage();
60 send_error_details_
= GCMClient::SendErrorDetails();
63 void FakeGCMAppHandler::OnConnected(const net::IPEndPoint
& ip_endpoint
) {
67 void FakeGCMAppHandler::OnDisconnected() {