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

Unified Diff: media/base/clock_unittest.cc

Issue 11607003: Add a Clock and TickClock interface for mocking out time (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix warnings Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/clock.cc ('k') | media/base/pipeline.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/clock_unittest.cc
diff --git a/media/base/clock_unittest.cc b/media/base/clock_unittest.cc
index 6773a5bb05210897e5c8693607b45dfb9785b0c1..919c7e5cb33566d4109de321262dcb90b48947d7 100644
--- a/media/base/clock_unittest.cc
+++ b/media/base/clock_unittest.cc
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/compiler_specific.h"
#include "base/logging.h"
-#include "base/test/mock_time_provider.h"
+#include "base/test/simple_test_clock.h"
+#include "base/time/clock.h"
#include "media/base/clock.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -28,11 +30,8 @@ static const int kDurationInSeconds = 120;
class ClockTest : public ::testing::Test {
public:
- ClockTest()
- : clock_(&base::MockTimeProvider::StaticNow) {
+ ClockTest() : clock_(&test_clock_) {
SetDuration();
- EXPECT_CALL(mock_time_, Now())
- .WillRepeatedly(Return(base::Time::UnixEpoch()));
}
protected:
@@ -44,13 +43,11 @@ class ClockTest : public ::testing::Test {
}
void AdvanceSystemTime(base::TimeDelta delta) {
- time_elapsed_ += delta;
- EXPECT_CALL(mock_time_, Now())
- .WillRepeatedly(Return(base::Time::UnixEpoch() + time_elapsed_));
+ test_clock_.Advance(delta);
}
+ base::SimpleTestClock test_clock_;
Clock clock_;
- StrictMock<base::MockTimeProvider> mock_time_;
base::TimeDelta time_elapsed_;
};
« no previous file with comments | « media/base/clock.cc ('k') | media/base/pipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698