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() : received_event_(NO_EVENT
) {
14 FakeGCMAppHandler::~FakeGCMAppHandler() {
17 void FakeGCMAppHandler::WaitForNotification() {
18 run_loop_
.reset(new base::RunLoop
);
23 void FakeGCMAppHandler::ShutdownHandler() {
26 void FakeGCMAppHandler::OnMessage(const std::string
& app_id
,
27 const GCMClient::IncomingMessage
& message
) {
29 received_event_
= MESSAGE_EVENT
;
36 void FakeGCMAppHandler::OnMessagesDeleted(const std::string
& app_id
) {
38 received_event_
= MESSAGES_DELETED_EVENT
;
44 void FakeGCMAppHandler::OnSendError(
45 const std::string
& app_id
,
46 const GCMClient::SendErrorDetails
& send_error_details
) {
48 received_event_
= SEND_ERROR_EVENT
;
50 send_error_details_
= send_error_details
;
55 void FakeGCMAppHandler::ClearResults() {
56 received_event_
= NO_EVENT
;
58 message_
= GCMClient::IncomingMessage();
59 send_error_details_
= GCMClient::SendErrorDetails();