#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <stddef.h>
#include <memory>
#include "media/mojo/services/mojo_video_encoder_metrics_provider_service.h"
#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/test_message_loop.h"
#include "components/ukm/test_ukm_recorder.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
UkmEntry;
TestWithParam;
ValuesIn;
namespace media {
namespace {
constexpr char kTestURL[] = …;
std::tuple<std::unique_ptr<ukm::TestAutoSetUkmRecorder>,
mojo::Remote<mojom::VideoEncoderMetricsProvider>>
Create(const std::string& url) { … }
}
class MojoVideoEncoderMetricsProviderServiceTest
: public TestWithParam<testing::tuple<uint64_t,
mojom::VideoEncoderUseCase,
VideoCodecProfile,
gfx::Size,
bool,
SVCScalabilityMode,
EncoderStatus::Codes>> { … };
TEST_F(MojoVideoEncoderMetricsProviderServiceTest, Create_NoUKMReport) { … }
#define EXPECT_UKM …
TEST_F(MojoVideoEncoderMetricsProviderServiceTest,
CreateAndInitialize_ReportUKM) { … }
TEST_F(MojoVideoEncoderMetricsProviderServiceTest,
CreateAndInitializeAndComplete_ReportUKM) { … }
TEST_F(
MojoVideoEncoderMetricsProviderServiceTest,
CreateAndInitializeAndSetSmallNumberEncodedFrameCount_ReportUKMWithOneBucket) { … }
TEST_P(MojoVideoEncoderMetricsProviderServiceTest,
CreateAndInitializeAndSetEncodedFrameCount_ReportUKM) { … }
TEST_P(MojoVideoEncoderMetricsProviderServiceTest,
CreateAndInitializeAndSetEncodedFrameCount_ReportUMA) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(MojoVideoEncoderMetricsProviderServiceTest,
InitializeWithVerfiyLargeResoloution_ReportCappedResolutionUKM) { … }
TEST_F(MojoVideoEncoderMetricsProviderServiceTest,
CallSetEncodedFrameCounts_ReportUKMWithTheLastEncodedFrameCount) { … }
TEST_F(MojoVideoEncoderMetricsProviderServiceTest,
CreateAndInitializeAndCallSetErrors_ReportUKMWithTheFirstError) { … }
TEST_F(MojoVideoEncoderMetricsProviderServiceTest,
CallErrorAndNoCallSetEncodedFramesCount_ReportUKMWithTheFirstError) { … }
TEST_F(
MojoVideoEncoderMetricsProviderServiceTest,
CallSetEncodedFrameCountsAndSetError_ReportUKMWithTheFirstErrorAndTheLastEncodedFrameCount) { … }
TEST_F(MojoVideoEncoderMetricsProviderServiceTest,
CreateAndTwoInitializeAndSetEncodedFrameCounts_ReportTwoUKMs) { … }
TEST_F(MojoVideoEncoderMetricsProviderServiceTest, HandleTwoEncoders) { … }
TEST_F(MojoVideoEncoderMetricsProviderServiceTest, IgnoreUnknownEncoderIds) { … }
#undef EXPECT_UKM
}