chromium/components/sharing_message/sharing_fcm_handler_unittest.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/sharing_message/sharing_fcm_handler.h"

#include <memory>

#include "base/test/task_environment.h"
#include "components/gcm_driver/fake_gcm_driver.h"
#include "components/sharing_message/fake_device_info.h"
#include "components/sharing_message/fake_sharing_handler_registry.h"
#include "components/sharing_message/features.h"
#include "components/sharing_message/mock_sharing_message_handler.h"
#include "components/sharing_message/proto/sharing_message.pb.h"
#include "components/sharing_message/sharing_constants.h"
#include "components/sharing_message/sharing_fcm_handler.h"
#include "components/sharing_message/sharing_fcm_sender.h"
#include "components/sharing_message/sharing_handler_registry.h"
#include "components/sync/protocol/device_info_specifics.pb.h"
#include "components/sync_device_info/device_info.h"
#include "components/sync_device_info/fake_device_info_sync_service.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

_;
Eq;
SharingMessage;

namespace {

const char kTestAppId[] =;
const char kTestMessageId[] =;
const char kTestMessageIdSecondaryUser[] =;
const char kOriginalMessageId[] =;
const char kSenderGuid[] =;
const char kSenderName[] =;
const char kVapidFCMToken[] =;
const char kVapidP256dh[] =;
const char kVapidAuthSecret[] =;
const char kSenderIdFCMToken[] =;
const char kSenderIdP256dh[] =;
const char kSenderIdAuthSecret[] =;
const char kServerConfiguration[] =;
const char kServerP256dh[] =;
const char kServerAuthSecret[] =;

void SetupFcmChannel(
    components_sharing_message::FCMChannelConfiguration* fcm_configuration) {}

class MockSharingFCMSender : public SharingFCMSender {};

class SharingFCMHandlerTest : public testing::Test {};

}  // namespace

MATCHER_P(ProtoEquals, message, "") {}

MATCHER(FCMChannelMatcher, "") {}

MATCHER(ServerChannelMatcher, "") {}
// Tests handling of SharingMessage with AckMessage payload. This is different
// from other payloads since we need to ensure AckMessage is not sent for
// SharingMessage with AckMessage payload.
TEST_F(SharingFCMHandlerTest, AckMessageHandler) {}

// Generic test for handling of SharingMessage payload other than AckMessage.
TEST_F(SharingFCMHandlerTest, PingMessageHandler) {}

TEST_F(SharingFCMHandlerTest, PingMessageHandlerWithMessageIdInPayload) {}

TEST_F(SharingFCMHandlerTest, PingMessageHandlerWithResponse) {}

// Test for handling of SharingMessage payload other than AckMessage for
// secondary users in Android.
TEST_F(SharingFCMHandlerTest, PingMessageHandlerSecondaryUser) {}

TEST_F(SharingFCMHandlerTest,
       PingMessageHandlerWithServerChannelConfiguration) {}