#include <queue>
#include <string>
#include <unordered_map>
#include "base/check.h"
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.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/mock_account_checker.h"
#include "components/commerce/core/subscriptions/commerce_subscription.h"
#include "components/commerce/core/subscriptions/subscriptions_manager.h"
#include "components/commerce/core/subscriptions/subscriptions_observer.h"
#include "components/commerce/core/subscriptions/subscriptions_server_proxy.h"
#include "components/commerce/core/subscriptions/subscriptions_storage.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "components/sync/base/features.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
_;
InSequence;
namespace {
std::unique_ptr<std::vector<commerce::CommerceSubscription>> BuildSubscriptions(
std::string subscription_id) { … }
commerce::CommerceSubscription BuildSubscription(std::string subscription_id) { … }
MATCHER_P(AreExpectedSubscriptions, expected_id, "") { … }
}
namespace commerce {
class MockSubscriptionsServerProxy : public SubscriptionsServerProxy { … };
class MockSubscriptionsStorage : public SubscriptionsStorage { … };
class SubscriptionsManagerTest : public testing::Test,
public commerce::SubscriptionsObserver { … };
TEST_F(SubscriptionsManagerTest, TestSyncSucceeded) { … }
TEST_F(SubscriptionsManagerTest, TestSyncFailedDueToStorage) { … }
TEST_F(SubscriptionsManagerTest, TestSyncFailedDueToServer) { … }
TEST_F(SubscriptionsManagerTest, TestNotSignedIn) { … }
TEST_F(SubscriptionsManagerTest, TestSubscribe) { … }
TEST_F(SubscriptionsManagerTest, TestSubscribe_ServerManageFailed) { … }
TEST_F(SubscriptionsManagerTest, TestSubscribe_LastSyncFailed) { … }
TEST_F(SubscriptionsManagerTest, TestSubscribe_HasRequestRunning) { … }
TEST_F(SubscriptionsManagerTest, TestSubscribe_HasStuckRequestRunning) { … }
TEST_F(SubscriptionsManagerTest, TestSubscribe_HasPendingUnsubscribeRequest) { … }
TEST_F(SubscriptionsManagerTest, TestSubscribe_ExistingSubscriptions) { … }
TEST_F(SubscriptionsManagerTest, TestUnsubscribe) { … }
TEST_F(SubscriptionsManagerTest, TestUnsubscribe_LastSyncFailed) { … }
TEST_F(SubscriptionsManagerTest,
TestUnsubscribe_LastSyncFailedWithRequestRunning) { … }
TEST_F(SubscriptionsManagerTest, TestUnsubscribe_NonExistingSubscriptions) { … }
TEST_F(SubscriptionsManagerTest, TestIdentityChange) { … }
TEST_F(SubscriptionsManagerTest,
TestIdentityChange_ReplaceSyncPromosWithSignInPromosEnabled) { … }
TEST_F(SubscriptionsManagerTest, TestIsSubscribed) { … }
TEST_F(SubscriptionsManagerTest, TestIsSubscribed_LastSyncFailed) { … }
TEST_F(SubscriptionsManagerTest, TestGetAllSubscriptions) { … }
TEST_F(SubscriptionsManagerTest, TestGetAllSubscriptions_LastSyncFailed) { … }
TEST_F(SubscriptionsManagerTest,
TestCheckTimestampOnBookmarkChange_NeedToSync) { … }
TEST_F(SubscriptionsManagerTest,
TestCheckTimestampOnBookmarkChange_NoNeedToSync) { … }
TEST_F(SubscriptionsManagerTest, TestSubscriptionsObserver) { … }
}