chromium/components/commerce/core/subscriptions/subscriptions_server_proxy_unittest.cc

// Copyright 2022 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/commerce/core/subscriptions/subscriptions_server_proxy.h"

#include <optional>
#include <queue>
#include <string>
#include <unordered_map>

#include "base/check.h"
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "base/test/gtest_util.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "components/commerce/core/commerce_constants.h"
#include "components/commerce/core/commerce_feature_list.h"
#include "components/commerce/core/subscriptions/commerce_subscription.h"
#include "components/commerce/core/subscriptions/subscriptions_storage.h"
#include "components/endpoint_fetcher/mock_endpoint_fetcher.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "net/http/http_status_code.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

_;
InSequence;

namespace {

const int64_t kMockTimestamp =;
const std::string kMockId1 =;
const std::string kMockId2 =;
const std::string kMockOfferId =;
const long kMockPrice =;
const std::string kMockCountry =;
const std::string kMockLocale =;

const char kServiceUrlForManage[] =;
const char kServiceUrlForGet[] =;

const std::string kExpectedPostDataForCreate =;
const std::string kExpectedPostDataForDelete =;
const std::string kResponseSucceeded =;
const std::string kResponseFailed =;
const std::string kValidGetResponse =;

// Build a subscription list consisting of two subscriptions.
std::unique_ptr<std::vector<commerce::CommerceSubscription>>
BuildValidSubscriptions() {}

// Build an empty subscription list.
std::unique_ptr<std::vector<commerce::CommerceSubscription>>
BuildEmptySubscriptions() {}

}  // namespace

namespace commerce {

class SpySubscriptionsServerProxy : public SubscriptionsServerProxy {};

class SubscriptionsServerProxyTest : public testing::Test {};

TEST_F(SubscriptionsServerProxyTest, TestCreate) {}

TEST_F(SubscriptionsServerProxyTest, TestCreate_EmptyList) {}

TEST_F(SubscriptionsServerProxyTest, TestCreate_ServerFailed) {}

TEST_F(SubscriptionsServerProxyTest, TestCreate_WrongHttpCode) {}

TEST_F(SubscriptionsServerProxyTest, TestCreate_EmptyResponse) {}

TEST_F(SubscriptionsServerProxyTest, TestDelete) {}

TEST_F(SubscriptionsServerProxyTest, TestDelete_EmptyList) {}

TEST_F(SubscriptionsServerProxyTest, TestDelete_ServerFailed) {}

TEST_F(SubscriptionsServerProxyTest, TestGet) {}

TEST_F(SubscriptionsServerProxyTest, TestGet_WrongType) {}

TEST_F(SubscriptionsServerProxyTest, TestGet_WrongHttpCode) {}

TEST_F(SubscriptionsServerProxyTest, TestGet_FetchError) {}

TEST_F(SubscriptionsServerProxyTest, TestGet_NoSubscriptions) {}

}  // namespace commerce