| Index: third_party/WebKit/Source/platform/TimerTest.cpp
|
| diff --git a/third_party/WebKit/Source/platform/TimerTest.cpp b/third_party/WebKit/Source/platform/TimerTest.cpp
|
| index 9bbb0a7149c1d32a8b5a44358e2483730f2bacd4..a2113e2f58ead3df4878278ff0096b48c6bb0db2 100644
|
| --- a/third_party/WebKit/Source/platform/TimerTest.cpp
|
| +++ b/third_party/WebKit/Source/platform/TimerTest.cpp
|
| @@ -19,11 +19,6 @@ namespace blink {
|
| namespace {
|
| double gCurrentTimeSecs = 0.0;
|
|
|
| -double currentTime()
|
| -{
|
| - return gCurrentTimeSecs;
|
| -}
|
| -
|
| // This class exists because gcc doesn't know how to move an OwnPtr.
|
| class RefCountedTaskContainer : public RefCounted<RefCountedTaskContainer> {
|
| public:
|
| @@ -44,7 +39,7 @@ class DelayedTask {
|
| public:
|
| DelayedTask(WebTaskRunner::Task* task, double delaySeconds)
|
| : m_task(adoptRef(new RefCountedTaskContainer(task)))
|
| - , m_runTimeSeconds(monotonicallyIncreasingTime() + delaySeconds)
|
| + , m_runTimeSeconds(gCurrentTimeSecs + delaySeconds)
|
| , m_delaySeconds(delaySeconds) { }
|
|
|
| bool operator<(const DelayedTask& other) const
|
| @@ -196,7 +191,6 @@ public:
|
|
|
| virtual bool isCurrentThread() const
|
| {
|
| - ASSERT_NOT_REACHED();
|
| return true;
|
| }
|
|
|
| @@ -227,6 +221,17 @@ public:
|
| ASSERT_NOT_REACHED();
|
| }
|
|
|
| + double virtualTimeSeconds() override
|
| + {
|
| + ASSERT_NOT_REACHED();
|
| + return 0.0;
|
| + }
|
| +
|
| + double monotonicallyIncreasingVirtualTimeSeconds() override
|
| + {
|
| + return gCurrentTimeSecs;
|
| + }
|
| +
|
| private:
|
| OwnPtr<MockWebScheduler> m_webScheduler;
|
| };
|
| @@ -280,8 +285,6 @@ class TimerTest : public testing::Test {
|
| public:
|
| void SetUp() override
|
| {
|
| - WTF::setMonotonicallyIncreasingTimeFunction(currentTime);
|
| -
|
| m_runTimes.clear();
|
| gCurrentTimeSecs = 10.0;
|
| m_startTime = gCurrentTimeSecs;
|
| @@ -289,12 +292,12 @@ public:
|
|
|
| void countingTask(Timer<TimerTest>*)
|
| {
|
| - m_runTimes.append(monotonicallyIncreasingTime());
|
| + m_runTimes.append(gCurrentTimeSecs);
|
| }
|
|
|
| void recordNextFireTimeTask(Timer<TimerTest>* timer)
|
| {
|
| - m_nextFireTimes.append(monotonicallyIncreasingTime() + timer->nextFireInterval());
|
| + m_nextFireTimes.append(gCurrentTimeSecs + timer->nextFireInterval());
|
| }
|
|
|
| void advanceTimeBy(double timeSecs)
|
| @@ -443,7 +446,7 @@ TEST_F(TimerTest, StartOneShot_NonZeroAndCancelThenRepost)
|
| runUntilIdle();
|
| EXPECT_FALSE(m_runTimes.size());
|
|
|
| - double secondPostTime = monotonicallyIncreasingTime();
|
| + double secondPostTime = gCurrentTimeSecs;
|
| timer.startOneShot(10, BLINK_FROM_HERE);
|
|
|
| ASSERT(hasOneTimerTask());
|
|
|