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

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

Issue 1441073006: Move throttling of background timers into the renderer scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Last few changes Sami requested Created 5 years, 1 month 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 | « third_party/WebKit/Source/platform/Timer.cpp ('k') | third_party/WebKit/public/platform/WebScheduler.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 4585d950a9ea94398c99ca95a6626896b7939ae3..9f7bd528ccc3a9d0a57b76069faf732fbfafe754 100644
--- a/third_party/WebKit/Source/platform/TimerTest.cpp
+++ b/third_party/WebKit/Source/platform/TimerTest.cpp
@@ -136,11 +136,6 @@ public:
return nullptr;
}
- void postTimerTaskAt(const WebTraceLocation&, WebTaskRunner::Task* task, double monotonicTime) override
- {
- m_timerTasks.push(DelayedTask(task, (monotonicTime - monotonicallyIncreasingTime()) * 1000));
- }
-
void runUntilIdle()
{
while (m_timerTasks.size()) {
@@ -698,80 +693,6 @@ TEST_F(TimerTest, AugmentRepeatInterval)
EXPECT_THAT(m_runTimes, ElementsAre(m_startTime + 20.0, m_startTime + 40.0));
}
-class MockTimerWithAlignment : public TimerBase {
-public:
- MockTimerWithAlignment() : m_lastFireTime(0.0), m_alignedFireTime(0.0) { }
-
- void fired() override
- {
- }
-
- double alignedFireTime(double fireTime) const override
- {
- m_lastFireTime = fireTime;
- return m_alignedFireTime;
- }
-
- void setAlignedFireTime(double alignedFireTime)
- {
- m_alignedFireTime = alignedFireTime;
- }
-
- double lastFireTime() const
- {
- return m_lastFireTime;
- }
-
-private:
- mutable double m_lastFireTime;
- double m_alignedFireTime;
-};
-
-TEST_F(TimerTest, TimerAlignment_OneShotZero)
-{
- MockTimerWithAlignment timer;
- timer.setAlignedFireTime(m_startTime + 1.0);
-
- timer.start(0.0, 0.0, BLINK_FROM_HERE);
-
- // The nextFireInterval gets overrriden.
- EXPECT_FLOAT_EQ(1.0, timer.nextFireInterval());
- EXPECT_FLOAT_EQ(0.0, timer.nextUnalignedFireInterval());
- EXPECT_FLOAT_EQ(m_startTime, timer.lastFireTime());
-}
-
-TEST_F(TimerTest, TimerAlignment_OneShotNonZero)
-{
- MockTimerWithAlignment timer;
- timer.setAlignedFireTime(m_startTime + 1.0);
-
- timer.start(0.5, 0.0, BLINK_FROM_HERE);
-
- // The nextFireInterval gets overrriden.
- EXPECT_FLOAT_EQ(1.0, timer.nextFireInterval());
- EXPECT_FLOAT_EQ(0.5, timer.nextUnalignedFireInterval());
- EXPECT_FLOAT_EQ(m_startTime + 0.5, timer.lastFireTime());
-}
-
-TEST_F(TimerTest, DidChangeAlignmentInterval)
-{
- MockTimerWithAlignment timer;
- timer.setAlignedFireTime(m_startTime + 1.0);
-
- timer.start(0.0, 0.0, BLINK_FROM_HERE);
-
- EXPECT_FLOAT_EQ(1.0, timer.nextFireInterval());
- EXPECT_FLOAT_EQ(0.0, timer.nextUnalignedFireInterval());
- EXPECT_FLOAT_EQ(m_startTime, timer.lastFireTime());
-
- timer.setAlignedFireTime(m_startTime);
- timer.didChangeAlignmentInterval(monotonicallyIncreasingTime());
-
- EXPECT_FLOAT_EQ(0.0, timer.nextFireInterval());
- EXPECT_FLOAT_EQ(0.0, timer.nextUnalignedFireInterval());
- EXPECT_FLOAT_EQ(m_startTime, timer.lastFireTime());
-}
-
TEST_F(TimerTest, RepeatingTimerDoesNotDrift)
{
Timer<TimerTest> timer(this, &TimerTest::recordNextFireTimeTask);
« no previous file with comments | « third_party/WebKit/Source/platform/Timer.cpp ('k') | third_party/WebKit/public/platform/WebScheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698