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

Unified Diff: third_party/WebKit/Source/platform/TimerTest.cpp

Issue 2433323003: Fix TestingPlatformSupportWithMockScheduler::runForPeriodSeconds (Closed)
Patch Set: Fix compile Created 4 years, 2 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 | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 719b8bee772a1164e80f94f3e9c5af8ab784bb79..06c3b110d613272c8d2a4451548f8e2d9a6b91a4 100644
--- a/third_party/WebKit/Source/platform/TimerTest.cpp
+++ b/third_party/WebKit/Source/platform/TimerTest.cpp
@@ -46,10 +46,6 @@ class TimerTest : public testing::Test {
double period = deadline - monotonicallyIncreasingTime();
EXPECT_GE(period, 0.0);
m_platform.runForPeriodSeconds(period);
-
- // We may have stopped before the clock advanced to |deadline|.
- double timeToAdvance = deadline - monotonicallyIncreasingTime();
- m_platform.advanceClockSeconds(timeToAdvance);
}
// Returns false if there are no pending delayed tasks, otherwise sets |time|
@@ -457,11 +453,14 @@ TEST_F(TimerTest, RepeatingTimerDoesNotDrift) {
// Next scheduled task to run at m_startTime + 10.0
m_platform.runForPeriodSeconds(2.9);
// Next scheduled task to run at m_startTime + 14.0 (skips a beat)
- m_platform.runForPeriodSeconds(3.1);
+ m_platform.advanceClockSeconds(3.1);
+ m_platform.runUntilIdle();
// Next scheduled task to run at m_startTime + 18.0 (skips a beat)
- m_platform.runForPeriodSeconds(4.0);
+ m_platform.advanceClockSeconds(4.0);
+ m_platform.runUntilIdle();
// Next scheduled task to run at m_startTime + 28.0 (skips 5 beats)
- m_platform.runForPeriodSeconds(10.0);
+ m_platform.advanceClockSeconds(10.0);
+ m_platform.runUntilIdle();
EXPECT_THAT(
m_nextFireTimes,
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698