#include <queue>
#include <string>
#include <unordered_map>
#include "base/check.h"
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "components/commerce/core/commerce_feature_list.h"
#include "components/commerce/core/proto/commerce_subscription_db_content.pb.h"
#include "components/commerce/core/subscriptions/commerce_subscription.h"
#include "components/commerce/core/subscriptions/subscriptions_storage.h"
#include "components/session_proto_db/session_proto_storage.h"
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
_;
InSequence;
namespace {
const int64_t kMockTimestamp1 = …;
const int64_t kMockTimestamp2 = …;
const int64_t kMockTimestamp3 = …;
const int64_t kMockTimestamp4 = …;
const std::string kMockId1 = …;
const std::string kMockId2 = …;
const std::string kMockId3 = …;
const std::string kKey1 = …;
const std::string kKey2 = …;
const std::string kKey3 = …;
std::unique_ptr<std::vector<commerce::CommerceSubscription>>
MockIncomingSubscriptions() { … }
std::unique_ptr<std::vector<commerce::CommerceSubscription>>
MockRemoteSubscriptions() { … }
std::vector<
SessionProtoStorage<commerce::CommerceSubscriptionProto>::KeyAndValue>
MockDbLoadResponse() { … }
commerce::CommerceSubscription BuildSubscription(std::string subscription_id) { … }
class MockProtoStorage
: public SessionProtoStorage<commerce::CommerceSubscriptionProto> { … };
}
namespace commerce {
class SubscriptionsStorageTest : public testing::Test { … };
TEST_F(SubscriptionsStorageTest, TestGetUniqueNonExistingSubscriptions) { … }
TEST_F(SubscriptionsStorageTest, TestGetUniqueExistingSubscriptions) { … }
TEST_F(SubscriptionsStorageTest, TestDeleteAll) { … }
TEST_F(SubscriptionsStorageTest, TestDeleteAll_Failed) { … }
TEST_F(SubscriptionsStorageTest, TestUpdateStorage) { … }
TEST_F(SubscriptionsStorageTest,
TestUpdateStorage_OneWithSameKeyDifferentTimestamp) { … }
TEST_F(SubscriptionsStorageTest, TestUpdateStorage_LoadFailed) { … }
TEST_F(SubscriptionsStorageTest, TestUpdateStorage_OperationFailed) { … }
TEST_F(SubscriptionsStorageTest, UpdateStorageAndNotifyModifiedSubscriptions) { … }
TEST_F(SubscriptionsStorageTest, TestIsSubscribed) { … }
TEST_F(SubscriptionsStorageTest, TestIsSubscribed_Failed) { … }
TEST_F(SubscriptionsStorageTest, TestIsSubscribed_EmptyResponse) { … }
}