chromium/components/gcm_driver/gcm_account_mapper_unittest.cc

// Copyright 2014 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/gcm_driver/gcm_account_mapper.h"

#include <memory>
#include <utility>

#include "base/functional/bind.h"
#include "base/test/simple_test_clock.h"
#include "base/time/time.h"
#include "components/gcm_driver/fake_gcm_driver.h"
#include "google_apis/gcm/engine/account_mapping.h"
#include "google_apis/gcm/engine/gcm_store.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace gcm {

namespace {

const char kGCMAccountMapperSenderId[] =;
const char kGCMAccountMapperSendTo[] =;
const char kRegistrationId[] =;
const char kEmbeddedAppIdKey[] =;
const char kTestAppId[] =;
const char kTestDataKey[] =;
const char kTestDataValue[] =;
const char kTestCollapseKey[] =;
const char kTestSenderId[] =;

AccountMapping MakeAccountMapping(const CoreAccountId& account_id,
                                  AccountMapping::MappingStatus status,
                                  const base::Time& status_change_timestamp,
                                  const std::string& last_message_id) {}

GCMClient::AccountTokenInfo MakeAccountTokenInfo(
    const CoreAccountId& account_id) {}
class CustomFakeGCMDriver : public FakeGCMDriver {};

CustomFakeGCMDriver::CustomFakeGCMDriver()
    :{}

CustomFakeGCMDriver::~CustomFakeGCMDriver() {}

void CustomFakeGCMDriver::UpdateAccountMapping(
    const AccountMapping& account_mapping) {}

void CustomFakeGCMDriver::RemoveAccountMapping(
    const CoreAccountId& account_id) {}

void CustomFakeGCMDriver::RegisterImpl(
    const std::string& app_id,
    const std::vector<std::string>& sender_ids) {}

void CustomFakeGCMDriver::CompleteRegister(const std::string& registration_id,
                                           GCMClient::Result result) {}

void CustomFakeGCMDriver::CompleteSend(const std::string& message_id,
                                       GCMClient::Result result) {}

void CustomFakeGCMDriver::AcknowledgeSend(const std::string& message_id) {}

void CustomFakeGCMDriver::MessageSendError(const std::string& message_id) {}

void CustomFakeGCMDriver::SendImpl(const std::string& app_id,
                                   const std::string& receiver_id,
                                   const OutgoingMessage& message) {}

void CustomFakeGCMDriver::CompleteSendAllMessages() {}

void CustomFakeGCMDriver::AcknowledgeSendAllMessages() {}

void CustomFakeGCMDriver::Clear() {}

void CustomFakeGCMDriver::SetLastMessageAction(const std::string& message_id,
                                               LastMessageAction action) {}

}  // namespace

class GCMAccountMapperTest : public testing::Test {};

GCMAccountMapperTest::GCMAccountMapperTest()
    :{}

GCMAccountMapperTest::~GCMAccountMapperTest() {}

void GCMAccountMapperTest::Restart() {}

void GCMAccountMapperTest::Initialize(
    const GCMAccountMapper::AccountMappings mappings) {}

void GCMAccountMapperTest::MessageReceived(const std::string& app_id,
                                           const IncomingMessage& message) {}

// Tests the initialization of account mappings (from the store) when empty.
// It also checks that initialization triggers registration ID request.
TEST_F(GCMAccountMapperTest, InitializeAccountMappingsEmpty) {}

// Tests that registration is retried, when new tokens are delivered and in no
// other circumstances.
TEST_F(GCMAccountMapperTest, RegistrationRetryUponFailure) {}

// Tests the initialization of account mappings (from the store).
TEST_F(GCMAccountMapperTest, InitializeAccountMappings) {}

// Tests that account tokens are not processed until registration ID is
// available.
TEST_F(GCMAccountMapperTest, SetAccountTokensOnlyWorksWithRegisterationId) {}

/// Tests a case when ADD message times out for a MAPPED account.
TEST_F(GCMAccountMapperTest, AddMappingMessageSendErrorForMappedAccount) {}

// Tests that account removing proceeds, when a removing message is acked after
// Chrome was restarted.
TEST_F(GCMAccountMapperTest, RemoveMappingMessageAckedAfterRestart) {}

// Tests that account removing proceeds, when a removing message is acked after
// Chrome was restarted.
TEST_F(GCMAccountMapperTest, RemoveMappingMessageSendError) {}

TEST_F(GCMAccountMapperTest, DispatchMessageSentToGaiaID) {}

}  // namespace gcm