#include <memory>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "media/base/mock_media_log.h"
#include "media/base/pipeline_status.h"
#include "media/base/test_helpers.h"
#include "media/base/watch_time_keys.h"
#include "media/mojo/mojom/media_metrics_provider.mojom.h"
#include "media/mojo/mojom/watch_time_recorder.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/media/display_type.h"
#include "third_party/blink/public/common/media/watch_time_component.h"
#include "third_party/blink/public/common/media/watch_time_reporter.h"
#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h"
namespace blink {
WatchTimeKey;
_;
constexpr gfx::Size kSizeTooSmall = …;
constexpr gfx::Size kSizeJustRight = …;
#define EXPECT_WATCH_TIME(key, value) …
#define EXPECT_MUTED_WATCH_TIME_IF_AUDIO_VIDEO(key, value) …
#define EXPECT_WATCH_TIME_IF_VIDEO(key, value) …
#define EXPECT_BACKGROUND_WATCH_TIME(key, value) …
#define EXPECT_WATCH_TIME_IF_AUDIO_VIDEO_MEDIAFOUNDATION(key, value) …
#define EXPECT_WATCH_TIME_FINALIZED() …
#define EXPECT_POWER_WATCH_TIME_FINALIZED() …
#define EXPECT_CONTROLS_WATCH_TIME_FINALIZED() …
#define EXPECT_DISPLAY_WATCH_TIME_FINALIZED() …
WatchTimeReporterTestData;
class WatchTimeReporterTest
: public testing::TestWithParam<WatchTimeReporterTestData> { … };
class DisplayTypeWatchTimeReporterTest : public WatchTimeReporterTest { … };
TEST_P(WatchTimeReporterTest, WatchTimeReporter) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterInfiniteStartTime) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterBasic) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterStatsOffsetCorrectly) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterDuration) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterUnderflow) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterUnderflowSpansFinalize) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterUnderflowTooLong) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterNoUnderflowDoubleReport) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterSecondaryProperties) { … }
TEST_P(WatchTimeReporterTest, SecondaryProperties_SizeIncreased) { … }
TEST_P(WatchTimeReporterTest, SecondaryProperties_SizeDecreased) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterAutoplayInitiated) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterShownHidden) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterBackgroundHysteresis) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterShownHiddenBackground) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterHiddenPausedBackground) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterHiddenSeekedBackground) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterHiddenPowerBackground) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterHiddenControlsBackground) { … }
TEST_P(DisplayTypeWatchTimeReporterTest,
WatchTimeReporterHiddenDisplayTypeBackground) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterHiddenMuted) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterMultiplePartialFinalize) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterNonZeroStart) { … }
TEST_P(WatchTimeReporterTest, SeekFinalizes) { … }
TEST_P(WatchTimeReporterTest, SeekOnlyClearedByPlaying) { … }
TEST_P(WatchTimeReporterTest, SeekFinalizeDoesNotTramplePreviousFinalize) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterFinalizeOnDestruction) { … }
TEST_P(WatchTimeReporterTest, WatchTimeCategoryMapping) { … }
TEST_P(WatchTimeReporterTest, PlayPauseHysteresisContinuation) { … }
TEST_P(WatchTimeReporterTest, PlayPauseHysteresisFinalized) { … }
TEST_P(WatchTimeReporterTest, OnVolumeChangeHysteresisContinuation) { … }
TEST_P(WatchTimeReporterTest, OnVolumeChangeHysteresisFinalized) { … }
TEST_P(WatchTimeReporterTest, OnShownHiddenHysteresisContinuation) { … }
TEST_P(WatchTimeReporterTest, OnShownHiddenHysteresisFinalized) { … }
TEST_P(WatchTimeReporterTest, OnPowerStateChangeHysteresisBatteryContinuation) { … }
TEST_P(WatchTimeReporterTest, OnPowerStateChangeHysteresisBatteryFinalized) { … }
TEST_P(WatchTimeReporterTest, OnPowerStateChangeHysteresisAcContinuation) { … }
TEST_P(WatchTimeReporterTest, OnPowerStateChangeHysteresisAcFinalized) { … }
TEST_P(WatchTimeReporterTest, OnPowerStateChangeBatteryTransitions) { … }
TEST_P(WatchTimeReporterTest, OnPowerStateChangeAcTransitions) { … }
TEST_P(WatchTimeReporterTest, OnControlsChangeHysteresisNativeContinuation) { … }
TEST_P(WatchTimeReporterTest, OnControlsChangeHysteresisNativeFinalized) { … }
TEST_P(WatchTimeReporterTest, OnControlsChangeHysteresisNativeOffContinuation) { … }
TEST_P(WatchTimeReporterTest, OnControlsChangeHysteresisNativeOffFinalized) { … }
TEST_P(WatchTimeReporterTest, OnControlsChangeToNativeOff) { … }
TEST_P(WatchTimeReporterTest, OnControlsChangeToNative) { … }
TEST_P(DisplayTypeWatchTimeReporterTest,
OnDisplayTypeChangeHysteresisFullscreenContinuation) { … }
TEST_P(DisplayTypeWatchTimeReporterTest,
OnDisplayTypeChangeHysteresisNativeFinalized) { … }
TEST_P(DisplayTypeWatchTimeReporterTest,
OnDisplayTypeChangeHysteresisInlineContinuation) { … }
TEST_P(DisplayTypeWatchTimeReporterTest,
OnDisplayTypeChangeHysteresisNativeOffFinalized) { … }
TEST_P(DisplayTypeWatchTimeReporterTest,
OnDisplayTypeChangeInlineToFullscreen) { … }
TEST_P(DisplayTypeWatchTimeReporterTest,
OnDisplayTypeChangeFullscreenToInline) { … }
TEST_P(WatchTimeReporterTest, HysteresisFinalizedWithEarliest) { … }
TEST_P(WatchTimeReporterTest, HysteresisPartialExitStillFinalizes) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterMediaFoundation) { … }
TEST_P(WatchTimeReporterTest, WatchTimeReporterMediaFoundationNoEme) { … }
class MutedWatchTimeReporterTest : public WatchTimeReporterTest { … };
TEST_P(MutedWatchTimeReporterTest, MutedHysteresis) { … }
TEST_P(MutedWatchTimeReporterTest, MuteUnmute) { … }
TEST_P(MutedWatchTimeReporterTest, MutedPaused) { … }
TEST_P(MutedWatchTimeReporterTest, MutedSeeked) { … }
TEST_P(MutedWatchTimeReporterTest, MutedPower) { … }
TEST_P(MutedWatchTimeReporterTest, MutedControls) { … }
TEST_P(MutedWatchTimeReporterTest, MutedDisplayType) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}