#include "components/feed/core/v2/metrics_reporter.h"
#include <map>
#include <memory>
#include <string_view>
#include "base/test/metrics/histogram_tester.h"
#include "base/test/metrics/user_action_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/feed/core/common/pref_names.h"
#include "components/feed/core/proto/v2/store.pb.h"
#include "components/feed/core/shared_prefs/pref_names.h"
#include "components/feed/core/v2/enums.h"
#include "components/feed/core/v2/feedstore_util.h"
#include "components/feed/core/v2/prefs.h"
#include "components/feed/core/v2/public/common_enums.h"
#include "components/feed/core/v2/public/feed_api.h"
#include "components/feed/core/v2/public/stream_type.h"
#include "components/feed/core/v2/public/types.h"
#include "components/feed/core/v2/test/callback_receiver.h"
#include "components/feed/core/v2/types.h"
#include "components/feed/feed_feature_list.h"
#include "components/prefs/testing_pref_service.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace feed {
StreamType kCombinedStreams = …;
constexpr SurfaceId kSurfaceId = …;
const base::TimeDelta kEpsilon = …;
const int kSubscriptionCount = …;
const ContentStats kContentStats = …;
MetricsReporter::LoadStreamResultSummary NetworkLoadResults() { … }
MetricsReporter::LoadStreamResultSummary LoadFailureResults(
LoadStreamStatus final_status) { … }
class MetricsReporterTest : public testing::Test, MetricsReporter::Delegate { … };
TEST_F(MetricsReporterTest, SliceViewedReportsSuggestionShown) { … }
TEST_F(MetricsReporterTest, LastSliceViewedReportsReachedEndOfFeed) { … }
TEST_F(MetricsReporterTest, WebFeed_LastSliceViewedReportsReachedEndOfFeed) { … }
TEST_F(MetricsReporterTest, ScrollingSmall) { … }
TEST_F(MetricsReporterTest, ScrollingCanTriggerEngaged) { … }
TEST_F(MetricsReporterTest, WebFeedEngagementRecordsSortType) { … }
TEST_F(MetricsReporterTest, OpeningContentIsInteracting) { … }
TEST_F(MetricsReporterTest, RemovingContentIsInteracting) { … }
TEST_F(MetricsReporterTest, NotInterestedInIsInteracting) { … }
TEST_F(MetricsReporterTest, ManageInterestsInIsInteracting) { … }
TEST_F(MetricsReporterTest, VisitsCanLastMoreThanFiveMinutes) { … }
TEST_F(MetricsReporterTest, NewVisitAfterInactivity) { … }
TEST_F(MetricsReporterTest, InteractedWithBothFeeds) { … }
TEST_F(MetricsReporterTest, ReportsLoadStreamStatus) { … }
TEST_F(MetricsReporterTest, ReportsLoadStreamStatusWhenDisabled) { … }
TEST_F(MetricsReporterTest, WebFeed_ReportsLoadStreamStatus) { … }
TEST_F(MetricsReporterTest, WebFeed_ReportsLoadStreamStatus_ReverseChron) { … }
TEST_F(MetricsReporterTest, WebFeed_ReportsNoContentShown) { … }
TEST_F(MetricsReporterTest, OnLoadStreamDoesNotReportLoadedCardCountOnFailure) { … }
TEST_F(MetricsReporterTest, ReportsLoadStreamStatusForManualRefresh) { … }
TEST_F(MetricsReporterTest,
SingleWebFeed_ReportsLoadStreamStatusForManualRefresh) { … }
TEST_F(MetricsReporterTest, ReportsLoadStreamStatusIgnoresNoStatusFromStore) { … }
TEST_F(MetricsReporterTest, ReportsContentAgeBlockingRefresh) { … }
TEST_F(MetricsReporterTest, ReportsContentAgeNoRefresh) { … }
TEST_F(MetricsReporterTest, DoNotReportContentAgeWhenNotPositive) { … }
TEST_F(MetricsReporterTest, ReportsLoadStepLatenciesOnFirstView) { … }
TEST_F(MetricsReporterTest, ReportsLoadMoreStatus) { … }
TEST_F(MetricsReporterTest, ReportsBackgroundRefreshStatus) { … }
TEST_F(MetricsReporterTest, WebFeed_ReportsBackgroundRefreshStatus) { … }
TEST_F(MetricsReporterTest, SingleWebFeed_ReportsBackgroundRefreshStatus) { … }
TEST_F(MetricsReporterTest, OpenAction) { … }
TEST_F(MetricsReporterTest, OpenActionWebFeed) { … }
TEST_F(MetricsReporterTest, OpenInNewTabAction) { … }
TEST_F(MetricsReporterTest, OpenInNewTabInGroupAction) { … }
TEST_F(MetricsReporterTest, OpenInNewIncognitoTabAction) { … }
TEST_F(MetricsReporterTest, SendFeedbackAction) { … }
TEST_F(MetricsReporterTest, DownloadAction) { … }
TEST_F(MetricsReporterTest, LearnMoreAction) { … }
TEST_F(MetricsReporterTest, RemoveAction) { … }
TEST_F(MetricsReporterTest, NotInterestedInAction) { … }
TEST_F(MetricsReporterTest, ManageInterestsAction) { … }
TEST_F(MetricsReporterTest, ContextMenuOpened) { … }
TEST_F(MetricsReporterTest, SurfaceOpened) { … }
TEST_F(MetricsReporterTest, SurfaceOpenedSingleWebFeedEntryPoint) { … }
TEST_F(MetricsReporterTest, OpenFeedSuccessDuration) { … }
TEST_F(MetricsReporterTest, WebFeed_OpenFeedSuccessDuration) { … }
TEST_F(MetricsReporterTest, SingleWebFeed_OpenFeedSuccessDuration) { … }
TEST_F(MetricsReporterTest, OpenFeedLoadTimeout) { … }
TEST_F(MetricsReporterTest, WebFeed_OpenFeedLoadTimeout) { … }
TEST_F(MetricsReporterTest, OpenFeedCloseBeforeLoad) { … }
TEST_F(MetricsReporterTest, WebFeed_OpenFeedCloseBeforeLoad) { … }
TEST_F(MetricsReporterTest, OpenCardSuccessDuration) { … }
TEST_F(MetricsReporterTest, WebFeed_OpenCardSuccessDuration) { … }
TEST_F(MetricsReporterTest, OpenCardTimeout) { … }
TEST_F(MetricsReporterTest, WebFeed_OpenCardTimeout) { … }
TEST_F(MetricsReporterTest, OpenCardFailureTwiceAndThenSucceed) { … }
TEST_F(MetricsReporterTest, WebFeed_OpenCardFailureTwiceAndThenSucceed) { … }
TEST_F(MetricsReporterTest, OpenCardCloseChromeFailure) { … }
TEST_F(MetricsReporterTest, TimeSpentInFeedCountsOnlyForegroundTime) { … }
TEST_F(MetricsReporterTest, TimeSpentInFeedLimitsIdleTime) { … }
TEST_F(MetricsReporterTest, TimeSpentInFeedIsPerDay) { … }
TEST_F(MetricsReporterTest, TimeSpentIsPersisted) { … }
TEST_F(MetricsReporterTest, TimeSpentInFeedTracksWholeScrollTime) { … }
TEST_F(MetricsReporterTest, TurnOnAction) { … }
TEST_F(MetricsReporterTest, TurnOffAction) { … }
TEST_F(MetricsReporterTest, NetworkRequestCompleteReportsUma) { … }
TEST_F(MetricsReporterTest, UserSettingsOnStart_FeedNotEnabled) { … }
TEST_F(MetricsReporterTest, UserSettingsOnStart_FeedNotEnabledByPolicy) { … }
TEST_F(MetricsReporterTest, UserSettingsOnStart_FeedNotVisible_SignedOut) { … }
TEST_F(MetricsReporterTest, UserSettingsOnStart_FeedNotVisible_SignedIn) { … }
TEST_F(MetricsReporterTest, UserSettingsOnStart_EnabledSignedOut) { … }
TEST_F(MetricsReporterTest, UserSettingsOnStart_WaaOffDpOff) { … }
TEST_F(MetricsReporterTest, UserSettingsOnStart_WaaOnDpOff) { … }
TEST_F(MetricsReporterTest, UserSettingsOnStart_WaaOffDpOn) { … }
TEST_F(MetricsReporterTest, UserSettingsOnStart_WaaOnDpOn) { … }
TEST_F(MetricsReporterTest, UserSettingsOnStart_FeedDataTooOld) { … }
TEST_F(MetricsReporterTest, UserSettingsOnStart_FeedDataFromFuture) { … }
TEST_F(MetricsReporterTest, ReportInfoCard) { … }
TEST_F(MetricsReporterTest, GoodVisit_Scroll_GoodTimeSpentInFeed) { … }
TEST_F(MetricsReporterTest, GoodVisit_GoodTimeSpentInFeed_Scroll) { … }
TEST_F(MetricsReporterTest, GoodVisit_SmallTimesDroppped) { … }
TEST_F(MetricsReporterTest, GoodVisit_LargeTimesCapped) { … }
TEST_F(MetricsReporterTest, GoodVisit_GoodExplicitInteraction_Share) { … }
TEST_F(MetricsReporterTest, GoodVisit_GoodExplicitInteraction_Download) { … }
TEST_F(MetricsReporterTest,
GoodVisit_GoodExplicitInteraction_AddToReadingList) { … }
TEST_F(MetricsReporterTest, GoodVisit_GoodExplicitInteraction_AddToReadLater) { … }
TEST_F(MetricsReporterTest, GoodVisit_GoodExplicitInteraction_Follow) { … }
TEST_F(MetricsReporterTest, GoodVisit_LongClick) { … }
TEST_F(MetricsReporterTest, GoodVisit_OnlyLoggedOncePerVisit) { … }
TEST_F(MetricsReporterTest, GoodVisitStateIsPersistent) { … }
TEST_F(MetricsReporterTest, OpenActionSingleWebFeed) { … }
TEST_F(MetricsReporterTest, SingleWebFeed_ReportsLoadStreamStatus) { … }
}