chromium/components/feed/core/v2/api_test/feed_api_subscriptions_unittest.cc

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

#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/protobuf_matchers.h"
#include "components/feed/core/proto/v2/wire/web_feeds.pb.h"
#include "components/feed/core/v2/api_test/feed_api_test.h"
#include "components/feed/core/v2/config.h"
#include "components/feed/core/v2/enums.h"
#include "components/feed/core/v2/feed_network.h"
#include "components/feed/core/v2/feed_stream.h"
#include "components/feed/core/v2/feedstore_util.h"
#include "components/feed/core/v2/public/feed_api.h"
#include "components/feed/core/v2/public/types.h"
#include "components/feed/core/v2/public/web_feed_subscriptions.h"
#include "components/feed/core/v2/test/callback_receiver.h"
#include "components/feed/core/v2/test/proto_printer.h"
#include "components/feed/core/v2/test/stream_builder.h"
#include "components/feed/core/v2/web_feed_subscription_coordinator.h"
#include "components/feed/feed_feature_list.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace feed {
namespace test {
namespace {
WebFeedChangeReason;
PrintToString;

AccountInfo TestAccountInfo() {}

FeedNetwork::RawResponse MakeFailedResponse() {}

void WriteRecommendedFeeds(
    FeedStore& store,
    std::vector<feedstore::WebFeedInfo> recommended_feeds) {}

void WriteSubscribedFeeds(
    FeedStore& store,
    std::vector<feedstore::WebFeedInfo> recommended_feeds) {}

class FeedApiSubscriptionsTest : public FeedApiTest {};

TEST_F(FeedApiSubscriptionsTest, FollowWebFeedSuccess) {}

TEST_F(FeedApiSubscriptionsTest, QueryWebFeedSuccess) {}

TEST_F(FeedApiSubscriptionsTest, QueryWebFeedError) {}

TEST_F(FeedApiSubscriptionsTest, QueryWebFeedInvalidUrlError) {}

TEST_F(FeedApiSubscriptionsTest, FollowWebFeedAbortOnClearAll) {}

TEST_F(FeedApiSubscriptionsTest, UnfollowWebFeedAbortOnClearAll) {}

TEST_F(FeedApiSubscriptionsTest, SubscribedWebFeedsAreLoadedFromStore) {}

TEST_F(FeedApiSubscriptionsTest, ClearAllAbortsModelLoad) {}

TEST_F(FeedApiSubscriptionsTest, FollowWebFeedSendsCanonicalUrl) {}

TEST_F(FeedApiSubscriptionsTest, FollowRecommendedWebFeedById) {}

// Make two Follow attempts for the same page. Both appear successful, but only
// one network request is made.
TEST_F(FeedApiSubscriptionsTest, FollowWebFeedTwiceAtOnce) {}

// Follow two different pages which resolve to the same web feed server-side.
TEST_F(FeedApiSubscriptionsTest, FollowWebFeedTwiceFromDifferentUrls) {}

TEST_F(FeedApiSubscriptionsTest, FollowTwoWebFeedsAtOnce) {}

TEST_F(FeedApiSubscriptionsTest, CantFollowWebFeedWhileOffline) {}

TEST_F(FeedApiSubscriptionsTest, CantFollowWebFeedByIdWhileOffline) {}

TEST_F(FeedApiSubscriptionsTest, FollowWebFeedNetworkError) {}

// Follow and then unfollow a web feed successfully.
TEST_F(FeedApiSubscriptionsTest, UnfollowAFollowedWebFeed) {}

TEST_F(FeedApiSubscriptionsTest, UnfollowAFollowedWebFeedTwiceAtOnce) {}

TEST_F(FeedApiSubscriptionsTest, UnfollowNetworkFailure) {}

TEST_F(FeedApiSubscriptionsTest, UnfollowWhileOffline) {}

// Try to unfollow a web feed that is already unfollowed. This is successful
// without any network requests.
TEST_F(FeedApiSubscriptionsTest, UnfollowAnUnfollowedWebFeed) {}

TEST_F(FeedApiSubscriptionsTest, FindWebFeedInfoForPageNotSubscribed) {}

TEST_F(FeedApiSubscriptionsTest, FindWebFeedInfoForWebFeedIdNotSubscribed) {}

TEST_F(FeedApiSubscriptionsTest,
       FindWebFeedInfoForWebFeedIdRecommendedButNotSubscribed) {}

// Call FindWebFeedInfoForPage for a web feed which is unknown, but after a
// successful subscription. This covers using FindWebFeedInfoForPage when a
// model is loaded.
TEST_F(FeedApiSubscriptionsTest,
       FindWebFeedInfoForPageNotSubscribedAfterSubscribe) {}

TEST_F(FeedApiSubscriptionsTest,
       FindWebFeedInfoForPageRecommendedAndNotSubscribed) {}

TEST_F(FeedApiSubscriptionsTest,
       FindWebFeedInfoForPageRecommendedSubscribeInProgress) {}

// Check FindWebFeedInfo*() for a web feed which is currently in the process of
// being subscribed.
TEST_F(FeedApiSubscriptionsTest,
       FindWebFeedInfoForPageNonRecommendedSubscribeInProgress) {}

// Check that FindWebFeedInfoForWebFeedId() returns information about a web feed
// which is currently in the process of being unsubscribed.
TEST_F(FeedApiSubscriptionsTest,
       FindWebFeedInfoForWebFeedIdUnsubscribeInProgress) {}

TEST_F(FeedApiSubscriptionsTest, GetAllSubscriptionsWithNoSubscriptions) {}

TEST_F(FeedApiSubscriptionsTest, GetAllSubscriptionsWithSomeSubscriptions) {}

TEST_F(FeedApiSubscriptionsTest,
       RecommendedWebFeedsAreNotFetchedAfterStartupWhenFeatureIsDisabled) {}

TEST_F(
    FeedApiSubscriptionsTest,
    RecommendedAndFollowedWebFeedsAreNotFetchedAfterStartupWhenFeedIsDisabled) {}

TEST_F(FeedApiSubscriptionsTest, RecommendedWebFeedsAreFetchedAfterStartup) {}

TEST_F(FeedApiSubscriptionsTest, RecommendedWebFeedsAreClearedOnSignOut) {}

TEST_F(FeedApiSubscriptionsTest,
       RecommendedWebFeedsAreFetchedAfterSignInButNotSignOut) {}

TEST_F(FeedApiSubscriptionsTest,
       RecommendedWebFeedsAreFetchedAfterStartupOnlyWhenStale) {}

TEST_F(FeedApiSubscriptionsTest,
       SubscribedWebFeedsAreNotFetchedAfterStartupWhenFeatureIsDisabled) {}

TEST_F(FeedApiSubscriptionsTest, SubscribedWebFeedsAreFetchedAfterStartup) {}

TEST_F(FeedApiSubscriptionsTest, SubscribedWebFeedsAreClearedOnSignOut) {}

TEST_F(FeedApiSubscriptionsTest,
       SubscribedWebFeedsAreFetchedAfterSignInButNotSignOut) {}

TEST_F(FeedApiSubscriptionsTest,
       SubscribedWebFeedsAreFetchedAfterStartupOnlyWhenStale) {}

TEST_F(FeedApiSubscriptionsTest, RefreshSubscriptionsSuccess) {}

TEST_F(FeedApiSubscriptionsTest, RefreshSubscriptionsFail) {}

// Two calls to RefreshSubscriptions at the same time, so only one refresh
// occurs.
TEST_F(FeedApiSubscriptionsTest, RefreshSubscriptionsDuringRefresh) {}

TEST_F(FeedApiSubscriptionsTest, FetchRecommendedWebFeedsAbortOnClearAll) {}

TEST_F(FeedApiSubscriptionsTest, FetchSubscribedWebFeedsRetryOnClearAll) {}

TEST_F(FeedApiSubscriptionsTest, FieldTrialRegistered_OneFollow) {}

TEST_F(FeedApiSubscriptionsTest, FollowWebFeedDurableSuccess) {}

TEST_F(FeedApiSubscriptionsTest, FollowWebFeedDurable_RemainsAfterFailure) {}

TEST_F(FeedApiSubscriptionsTest, UnfollowWebFeedDurable_RemainsAfterFailure) {}

TEST_F(FeedApiSubscriptionsTest, FollowWebFeedDurable_AbortsPreviousDurable) {}

TEST_F(FeedApiSubscriptionsTest, RetryPendingOperations_Success) {}

TEST_F(FeedApiSubscriptionsTest, RetryPendingOperations_Failure) {}

TEST_F(FeedApiSubscriptionsTest, RetryPendingOperations_ExceedsRetryLimit) {}

TEST_F(FeedApiSubscriptionsTest, RetryPendingOperations_AbortsWhenOffline) {}

TEST_F(FeedApiSubscriptionsTest, RefreshSubscriptions_TriggersRetryPending) {}

TEST_F(FeedApiSubscriptionsTest, Startup_PendingRequestsAreEventuallyRetried) {}

TEST_F(FeedApiSubscriptionsTest, PendingOperations_RemovedOnClearAll) {}

TEST_F(FeedApiSubscriptionsTest, DataStoreReceivesFollowState) {}

TEST_F(FeedApiSubscriptionsTest, FollowWebFeedBeforeFeedStreamInitialized) {}

}  // namespace
}  // namespace test
}  // namespace feed