#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) { … }
TEST_F(FeedApiSubscriptionsTest, FollowWebFeedTwiceAtOnce) { … }
TEST_F(FeedApiSubscriptionsTest, FollowWebFeedTwiceFromDifferentUrls) { … }
TEST_F(FeedApiSubscriptionsTest, FollowTwoWebFeedsAtOnce) { … }
TEST_F(FeedApiSubscriptionsTest, CantFollowWebFeedWhileOffline) { … }
TEST_F(FeedApiSubscriptionsTest, CantFollowWebFeedByIdWhileOffline) { … }
TEST_F(FeedApiSubscriptionsTest, FollowWebFeedNetworkError) { … }
TEST_F(FeedApiSubscriptionsTest, UnfollowAFollowedWebFeed) { … }
TEST_F(FeedApiSubscriptionsTest, UnfollowAFollowedWebFeedTwiceAtOnce) { … }
TEST_F(FeedApiSubscriptionsTest, UnfollowNetworkFailure) { … }
TEST_F(FeedApiSubscriptionsTest, UnfollowWhileOffline) { … }
TEST_F(FeedApiSubscriptionsTest, UnfollowAnUnfollowedWebFeed) { … }
TEST_F(FeedApiSubscriptionsTest, FindWebFeedInfoForPageNotSubscribed) { … }
TEST_F(FeedApiSubscriptionsTest, FindWebFeedInfoForWebFeedIdNotSubscribed) { … }
TEST_F(FeedApiSubscriptionsTest,
FindWebFeedInfoForWebFeedIdRecommendedButNotSubscribed) { … }
TEST_F(FeedApiSubscriptionsTest,
FindWebFeedInfoForPageNotSubscribedAfterSubscribe) { … }
TEST_F(FeedApiSubscriptionsTest,
FindWebFeedInfoForPageRecommendedAndNotSubscribed) { … }
TEST_F(FeedApiSubscriptionsTest,
FindWebFeedInfoForPageRecommendedSubscribeInProgress) { … }
TEST_F(FeedApiSubscriptionsTest,
FindWebFeedInfoForPageNonRecommendedSubscribeInProgress) { … }
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) { … }
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) { … }
}
}
}