diff options
Diffstat (limited to 'chromium/media/filters/video_renderer_algorithm_unittest.cc')
-rw-r--r-- | chromium/media/filters/video_renderer_algorithm_unittest.cc | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/chromium/media/filters/video_renderer_algorithm_unittest.cc b/chromium/media/filters/video_renderer_algorithm_unittest.cc index 88b2656d192..483fcedd980 100644 --- a/chromium/media/filters/video_renderer_algorithm_unittest.cc +++ b/chromium/media/filters/video_renderer_algorithm_unittest.cc @@ -40,8 +40,7 @@ class TickGenerator { base_time_(base_timestamp) {} base::TimeDelta interval(int tick_count) const { - return base::TimeDelta::FromMicroseconds(tick_count * - microseconds_per_tick_); + return base::Microseconds(tick_count * microseconds_per_tick_); } base::TimeTicks current() const { return base_time_ + interval(tick_count_); } @@ -78,9 +77,14 @@ class VideoRendererAlgorithmTest : public testing::Test { &media_log_) { // Always start the TickClock at a non-zero value since null values have // special connotations. - tick_clock_->Advance(base::TimeDelta::FromMicroseconds(10000)); + tick_clock_->Advance(base::Microseconds(10000)); time_source_.SetTickClockForTesting(tick_clock_.get()); } + + VideoRendererAlgorithmTest(const VideoRendererAlgorithmTest&) = delete; + VideoRendererAlgorithmTest& operator=(const VideoRendererAlgorithmTest&) = + delete; + ~VideoRendererAlgorithmTest() override = default; scoped_refptr<VideoFrame> CreateFrame(base::TimeDelta timestamp) { @@ -91,7 +95,7 @@ class VideoRendererAlgorithmTest : public testing::Test { } base::TimeDelta minimum_glitch_time() const { - return base::TimeDelta::FromSeconds( + return base::Seconds( VideoRendererAlgorithm::kMinimumAcceptableTimeBetweenGlitchesSecs); } @@ -326,9 +330,6 @@ class VideoRendererAlgorithmTest : public testing::Test { std::unique_ptr<base::SimpleTestTickClock> tick_clock_; WallClockTimeSource time_source_; VideoRendererAlgorithm algorithm_; - - private: - DISALLOW_COPY_AND_ASSIGN(VideoRendererAlgorithmTest); }; TEST_F(VideoRendererAlgorithmTest, Empty) { @@ -1007,16 +1008,14 @@ TEST_F(VideoRendererAlgorithmTest, BestFrameByCoverage) { // 49/51 coverage for frame 0 and frame 1 should be within tolerance such that // the earlier frame should still be chosen. - deadline_min = tg.current() + tg.interval(1) / 2 + - base::TimeDelta::FromMicroseconds(250); + deadline_min = tg.current() + tg.interval(1) / 2 + base::Microseconds(250); deadline_max = deadline_min + tg.interval(1); EXPECT_EQ(0, FindBestFrameByCoverage(deadline_min, deadline_max, &second_best)); EXPECT_EQ(1, second_best); // 48/52 coverage should result in the second frame being chosen. - deadline_min = tg.current() + tg.interval(1) / 2 + - base::TimeDelta::FromMicroseconds(500); + deadline_min = tg.current() + tg.interval(1) / 2 + base::Microseconds(500); deadline_max = deadline_min + tg.interval(1); EXPECT_EQ(1, FindBestFrameByCoverage(deadline_min, deadline_max, &second_best)); @@ -1414,12 +1413,12 @@ TEST_F(VideoRendererAlgorithmTest, VariablePlaybackRateCadence) { TickGenerator frame_tg(base::TimeTicks(), NTSC(30)); TickGenerator display_tg(tick_clock_->NowTicks(), 60); - const double kTestRates[] = {1.0, 2, 0.215, 0.5, 1.0, 3.15}; - const bool kTestRateHasCadence[base::size(kTestRates)] = {true, true, true, - true, true, false}; + const double kPlaybackRates[] = {1.0, 2, 0.215, 0.5, 1.0, 3.15}; + const bool kTestRateHasCadence[base::size(kPlaybackRates)] = { + true, true, true, true, true, false}; - for (size_t i = 0; i < base::size(kTestRates); ++i) { - const double playback_rate = kTestRates[i]; + for (size_t i = 0; i < base::size(kPlaybackRates); ++i) { + const double playback_rate = kPlaybackRates[i]; SCOPED_TRACE(base::StringPrintf("Playback Rate: %.03f", playback_rate)); time_source_.SetPlaybackRate(playback_rate); RunFramePumpTest( @@ -1452,7 +1451,7 @@ TEST_F(VideoRendererAlgorithmTest, UglyTimestampsHaveCadence) { for (size_t i = 0; i < base::size(kBadTimestampsMs) * 2; ++i) { while (EffectiveFramesQueued() < 3) { algorithm_.EnqueueFrame(CreateFrame(timestamp)); - timestamp += base::TimeDelta::FromMilliseconds( + timestamp += base::Milliseconds( kBadTimestampsMs[i % base::size(kBadTimestampsMs)]); } @@ -1487,7 +1486,7 @@ TEST_F(VideoRendererAlgorithmTest, VariableFrameRateNoCadence) { for (size_t i = 0; i < base::size(kBadTimestampsMs);) { while (EffectiveFramesQueued() < 3) { algorithm_.EnqueueFrame(CreateFrame(timestamp)); - timestamp += base::TimeDelta::FromMilliseconds( + timestamp += base::Milliseconds( kBadTimestampsMs[i % base::size(kBadTimestampsMs)]); ++i; } @@ -1551,7 +1550,7 @@ TEST_F(VideoRendererAlgorithmTest, EnqueueFrames) { EXPECT_EQ(2, GetCurrentFrameDisplayCount()); // Trying to add a frame < 1 ms after the last frame should drop the frame. - algorithm_.EnqueueFrame(CreateFrame(base::TimeDelta::FromMicroseconds(999))); + algorithm_.EnqueueFrame(CreateFrame(base::Microseconds(999))); rendered_frame = RenderAndStep(&tg, &frames_dropped); EXPECT_EQ(1u, frames_queued()); EXPECT_EQ(frame_1, rendered_frame); @@ -1564,7 +1563,7 @@ TEST_F(VideoRendererAlgorithmTest, EnqueueFrames) { // Trying to add a frame < 1 ms before the last frame should drop the frame. algorithm_.EnqueueFrame( - CreateFrame(tg.interval(1) - base::TimeDelta::FromMicroseconds(999))); + CreateFrame(tg.interval(1) - base::Microseconds(999))); rendered_frame = RenderAndStep(&tg, &frames_dropped); EXPECT_EQ(1u, frames_queued()); EXPECT_EQ(frame_3, rendered_frame); @@ -1595,7 +1594,7 @@ TEST_F(VideoRendererAlgorithmTest, CadenceForFutureFrames) { // Add some noise to the tick generator so it our first frame // doesn't line up evenly on a deadline. - tg.Reset(tg.current() + base::TimeDelta::FromMilliseconds(5)); + tg.Reset(tg.current() + base::Milliseconds(5)); // We're now at the first frame, cadence should be one, so // it should only be displayed once. @@ -1645,7 +1644,7 @@ TEST_F(VideoRendererAlgorithmTest, UsesFrameDuration) { EXPECT_EQ(tg.interval(1), algorithm_.average_frame_duration()); // Add a bunch of normal frames and then one with a 3s duration. - constexpr base::TimeDelta kLongDuration = base::TimeDelta::FromSeconds(3); + constexpr base::TimeDelta kLongDuration = base::Seconds(3); for (int i = 1; i < 4; ++i) { frame = CreateFrame(tg.interval(i)); frame->metadata().frame_duration = i == 3 ? kLongDuration : tg.interval(1); |