Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(716)

Side by Side Diff: media/base/time_delta_interpolator_unittest.cc

Issue 2239243002: Interpolate media time for mojo rendering pipeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moves media-time clamping to PipelineImpl Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/time_delta_interpolator.cc ('k') | media/mojo/clients/mojo_renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "base/test/simple_test_tick_clock.h" 6 #include "base/test/simple_test_tick_clock.h"
7 #include "media/base/time_delta_interpolator.h" 7 #include "media/base/time_delta_interpolator.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 AdvanceSystemTime(kPlayDuration); 122 AdvanceSystemTime(kPlayDuration);
123 EXPECT_EQ(kExpectedSecondPause, interpolator_.StopInterpolating()); 123 EXPECT_EQ(kExpectedSecondPause, interpolator_.StopInterpolating());
124 EXPECT_EQ(kExpectedSecondPause, interpolator_.GetInterpolatedTime()); 124 EXPECT_EQ(kExpectedSecondPause, interpolator_.GetInterpolatedTime());
125 } 125 }
126 126
127 TEST_F(TimeDeltaInterpolatorTest, SetBounds_Stopped) { 127 TEST_F(TimeDeltaInterpolatorTest, SetBounds_Stopped) {
128 const base::TimeDelta kFirstTime = base::TimeDelta::FromSeconds(4); 128 const base::TimeDelta kFirstTime = base::TimeDelta::FromSeconds(4);
129 const base::TimeDelta kSecondTime = base::TimeDelta::FromSeconds(16); 129 const base::TimeDelta kSecondTime = base::TimeDelta::FromSeconds(16);
130 const base::TimeDelta kArbitraryMaxTime = base::TimeDelta::FromSeconds(100); 130 const base::TimeDelta kArbitraryMaxTime = base::TimeDelta::FromSeconds(100);
131 131
132 interpolator_.SetBounds(kFirstTime, kArbitraryMaxTime); 132 interpolator_.SetBounds(kFirstTime, kArbitraryMaxTime,
133 test_tick_clock_.NowTicks());
133 EXPECT_EQ(kFirstTime, interpolator_.GetInterpolatedTime()); 134 EXPECT_EQ(kFirstTime, interpolator_.GetInterpolatedTime());
134 interpolator_.SetBounds(kSecondTime, kArbitraryMaxTime); 135 interpolator_.SetBounds(kSecondTime, kArbitraryMaxTime,
136 test_tick_clock_.NowTicks());
135 EXPECT_EQ(kSecondTime, interpolator_.GetInterpolatedTime()); 137 EXPECT_EQ(kSecondTime, interpolator_.GetInterpolatedTime());
136 } 138 }
137 139
138 TEST_F(TimeDeltaInterpolatorTest, SetBounds_Started) { 140 TEST_F(TimeDeltaInterpolatorTest, SetBounds_Started) {
139 // We'll play for 4 seconds, then set the time to 12, then play for 4 more 141 // We'll play for 4 seconds, then set the time to 12, then play for 4 more
140 // seconds. 142 // seconds.
141 const base::TimeDelta kZero; 143 const base::TimeDelta kZero;
142 const base::TimeDelta kPlayDuration = base::TimeDelta::FromSeconds(4); 144 const base::TimeDelta kPlayDuration = base::TimeDelta::FromSeconds(4);
143 const base::TimeDelta kUpdatedTime = base::TimeDelta::FromSeconds(12); 145 const base::TimeDelta kUpdatedTime = base::TimeDelta::FromSeconds(12);
144 const base::TimeDelta kArbitraryMaxTime = base::TimeDelta::FromSeconds(100); 146 const base::TimeDelta kArbitraryMaxTime = base::TimeDelta::FromSeconds(100);
145 const base::TimeDelta kExpected = kUpdatedTime + kPlayDuration; 147 const base::TimeDelta kExpected = kUpdatedTime + kPlayDuration;
146 148
147 EXPECT_EQ(kZero, interpolator_.StartInterpolating()); 149 EXPECT_EQ(kZero, interpolator_.StartInterpolating());
148 AdvanceSystemTime(kPlayDuration); 150 AdvanceSystemTime(kPlayDuration);
149 151
150 interpolator_.SetBounds(kUpdatedTime, kArbitraryMaxTime); 152 interpolator_.SetBounds(kUpdatedTime, kArbitraryMaxTime,
153 test_tick_clock_.NowTicks());
151 AdvanceSystemTime(kPlayDuration); 154 AdvanceSystemTime(kPlayDuration);
152 EXPECT_EQ(kExpected, interpolator_.GetInterpolatedTime()); 155 EXPECT_EQ(kExpected, interpolator_.GetInterpolatedTime());
153 } 156 }
154 157
155 TEST_F(TimeDeltaInterpolatorTest, SetUpperBound) { 158 TEST_F(TimeDeltaInterpolatorTest, SetUpperBound) {
156 const base::TimeDelta kZero; 159 const base::TimeDelta kZero;
157 const base::TimeDelta kTimeInterval = base::TimeDelta::FromSeconds(4); 160 const base::TimeDelta kTimeInterval = base::TimeDelta::FromSeconds(4);
158 const base::TimeDelta kMaxTime = base::TimeDelta::FromSeconds(6); 161 const base::TimeDelta kMaxTime = base::TimeDelta::FromSeconds(6);
159 162
160 EXPECT_EQ(kZero, interpolator_.StartInterpolating()); 163 EXPECT_EQ(kZero, interpolator_.StartInterpolating());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 EXPECT_EQ(kMaxTime1, interpolator_.GetInterpolatedTime()); 195 EXPECT_EQ(kMaxTime1, interpolator_.GetInterpolatedTime());
193 196
194 AdvanceSystemTime(kTimeInterval); 197 AdvanceSystemTime(kTimeInterval);
195 EXPECT_EQ(kMaxTime1 + kTimeInterval, interpolator_.GetInterpolatedTime()); 198 EXPECT_EQ(kMaxTime1 + kTimeInterval, interpolator_.GetInterpolatedTime());
196 199
197 AdvanceSystemTime(kTimeInterval); 200 AdvanceSystemTime(kTimeInterval);
198 EXPECT_EQ(kMaxTime2, interpolator_.GetInterpolatedTime()); 201 EXPECT_EQ(kMaxTime2, interpolator_.GetInterpolatedTime());
199 } 202 }
200 203
201 } // namespace media 204 } // namespace media
OLDNEW
« no previous file with comments | « media/base/time_delta_interpolator.cc ('k') | media/mojo/clients/mojo_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698