// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "cc/metrics/video_playback_roughness_reporter.h" #include <algorithm> #include <memory> #include <random> #include <vector> #include "base/functional/callback.h" #include "base/test/bind.h" #include "base/time/time.h" #include "testing/gtest/include/gtest/gtest.h" VideoFrame; VideoFrameMetadata; namespace cc { class VideoPlaybackRoughnessReporterTest : public ::testing::Test { … }; TEST_F(VideoPlaybackRoughnessReporterTest, BestCase24fps) { … } TEST_F(VideoPlaybackRoughnessReporterTest, BestCase24fpsOn120Hz) { … } TEST_F(VideoPlaybackRoughnessReporterTest, BestCase30fps) { … } // This cadence pattern was used in the small user study and was found // to be perceived by participants as not as good as ideal 30fps playback but // better than the pattern from UserStudyBad. // The main characteristic of this test is that cadence breaks by having a frame // shown only once, but the very next frame is being shown 3 times thus // fixing the synchronization. TEST_F(VideoPlaybackRoughnessReporterTest, UserStudyOkay) { … } // This cadence pattern was used in the small user study and was found // to be perceived as worst of all options in the study. // The main characteristic of this test is that cadence breaks by having a frame // shown only once, and it takes 2 more frames for a frame that is shown 3 times // thus fixing the synchronization. TEST_F(VideoPlaybackRoughnessReporterTest, UserStudyBad) { … } TEST_F(VideoPlaybackRoughnessReporterTest, Glitchy24fps) { … } TEST_F(VideoPlaybackRoughnessReporterTest, BestCase60fps) { … } TEST_F(VideoPlaybackRoughnessReporterTest, BestCase50fps) { … } // Test that we understand the roughness algorithm by checking that we can // get any result we need. TEST_F(VideoPlaybackRoughnessReporterTest, PredictableRoughnessValue) { … } // Test that the reporter indeed takes 95% worst window. TEST_F(VideoPlaybackRoughnessReporterTest, TakingPercentile) { … } // Test that even if no windows can be reported due to unstable presentation // feedback, the reporter still doesn't run out of memory. TEST_F(VideoPlaybackRoughnessReporterTest, LongRunWithoutWindows) { … } // Test that the reporter is no spooked by FramePresented() on unknown frame // tokens. TEST_F(VideoPlaybackRoughnessReporterTest, PresentingUnknownFrames) { … } // Test that the reporter is ignoring frames with unreliable // presentation timestamp. TEST_F(VideoPlaybackRoughnessReporterTest, IgnoringUnreliableTimings) { … } // Test that Reset() causes reporting if there is sufficient number of windows // accumulated. TEST_F(VideoPlaybackRoughnessReporterTest, ReportingInReset) { … } // Test that a change of display refresh rate or frame size causes reporting // iff there is sufficient number of windows accumulated. TEST_F(VideoPlaybackRoughnessReporterTest, ReportingAfterParameterChange) { … } // Test that reporting works even if frame presentation signal come out of // order. TEST_F(VideoPlaybackRoughnessReporterTest, BatchPresentation) { … } TEST_F(VideoPlaybackRoughnessReporterTest, Freezing30fps) { … } } // namespace cc