#include <cstddef>
#include <sstream>
#include "base/functional/callback_helpers.h"
#include "base/strings/strcat.h"
#include "build/buildflag.h"
#include "components/feed/core/proto/v2/wire/reliability_logging_enums.pb.h"
#include "components/feed/core/shared_prefs/pref_names.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/feedstore_util.h"
#include "components/feed/core/v2/public/feed_service.h"
#include "components/feed/core/v2/public/stream_type.h"
#include "components/feed/core/v2/test/callback_receiver.h"
#include "net/http/http_status_code.h"
namespace feed {
namespace test {
namespace {
class FeedApiReliabilityLoggingTest : public FeedApiTest { … };
TEST_F(FeedApiReliabilityLoggingTest, AttachSurface_LogFeedLaunchOtherStart) { … }
TEST_F(FeedApiReliabilityLoggingTest, AttachSurface_EulaNotAccepted) { … }
TEST_F(FeedApiReliabilityLoggingTest, AttachSurface_ArticlesListHidden) { … }
TEST_F(FeedApiReliabilityLoggingTest,
AttachSurface_DisabledByEnterprisePolicy) { … }
#if BUILDFLAG(IS_ANDROID)
TEST_F(FeedApiReliabilityLoggingTest, AttachSurface_DisabledByDse) {
profile_prefs_.SetBoolean(prefs::kEnableSnippetsByDse, false);
CreateStream(true,
true);
TestForYouSurface surface(stream_.get());
EXPECT_EQ(
"LogFeedLaunchOtherStart\n"
"LogLaunchFinishedAfterStreamUpdate "
"result=INELIGIBLE_DISCOVER_DISABLED_BY_DSE\n"
"LogAboveTheFoldRender result=FULL_FEED_ERROR\n",
surface.reliability_logging_bridge.GetEventsString());
}
#endif
TEST_F(FeedApiReliabilityLoggingTest, AttachSurface_ClearAllInProgress) { … }
TEST_F(FeedApiReliabilityLoggingTest, AttachSurface_DataInStoreForAnotherUser) { … }
TEST_F(FeedApiReliabilityLoggingTest, MultipleSurfaces_SimultaneousLoad) { … }
TEST_F(FeedApiReliabilityLoggingTest,
MultipleSurfaces_FullyLoadThenAttachAnother) { … }
TEST_F(FeedApiReliabilityLoggingTest, LoadStreamComplete_Success) { … }
TEST_F(FeedApiReliabilityLoggingTest, LoadStreamComplete_ZeroCards) { … }
TEST_F(FeedApiReliabilityLoggingTest, LoadStreamComplete_NetworkOffline) { … }
TEST_F(FeedApiReliabilityLoggingTest, LoadStreamComplete_NoResponseReceived) { … }
TEST_F(FeedApiReliabilityLoggingTest,
LoadStreamComplete_ResponseReceivedWithHttpError) { … }
TEST_F(FeedApiReliabilityLoggingTest, CacheRead_Stale) { … }
TEST_F(FeedApiReliabilityLoggingTest, CacheRead_StaleWithNetworkError) { … }
TEST_F(FeedApiReliabilityLoggingTest, CacheRead_Okay) { … }
TEST_F(FeedApiReliabilityLoggingTest, UploadActions) { … }
TEST_F(FeedApiReliabilityLoggingTest, GetAndResetId) { … }
TEST_F(FeedApiReliabilityLoggingTest, IdChangeOnMetricsIdChange) { … }
TEST_F(FeedApiReliabilityLoggingTest, WebFeedLoad) { … }
TEST_F(FeedApiReliabilityLoggingTest, SingleWebFeedLoad) { … }
TEST_F(FeedApiReliabilityLoggingTest, LoadMoreSucceeds) { … }
TEST_F(FeedApiReliabilityLoggingTest, LoadMoreFails) { … }
TEST_F(FeedApiReliabilityLoggingTest, LoadMoreAbortsIfNoNextPageToken) { … }
}
}
}