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

Side by Side Diff: third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp

Issue 2118903002: scheduler: Move the Blink scheduler into Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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
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 "core/layout/ImageQualityController.h" 5 #include "core/layout/ImageQualityController.h"
6 6
7 #include "core/layout/LayoutImage.h" 7 #include "core/layout/LayoutImage.h"
8 #include "core/layout/LayoutTestHelper.h" 8 #include "core/layout/LayoutTestHelper.h"
9 #include "platform/graphics/GraphicsContext.h" 9 #include "platform/graphics/GraphicsContext.h"
10 #include "platform/graphics/paint/PaintController.h" 10 #include "platform/graphics/paint/PaintController.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 { 130 {
131 if (m_currentTask) 131 if (m_currentTask)
132 delete m_currentTask; 132 delete m_currentTask;
133 m_currentTask = task; 133 m_currentTask = task;
134 134
135 } 135 }
136 bool runsTasksOnCurrentThread() override { return true; } 136 bool runsTasksOnCurrentThread() override { return true; }
137 std::unique_ptr<WebTaskRunner> clone() override { return nullptr; } 137 std::unique_ptr<WebTaskRunner> clone() override { return nullptr; }
138 double virtualTimeSeconds() const override { return 0.0; } 138 double virtualTimeSeconds() const override { return 0.0; }
139 double monotonicallyIncreasingVirtualTimeSeconds() const override { return m _time; } 139 double monotonicallyIncreasingVirtualTimeSeconds() const override { return m _time; }
140 SingleThreadTaskRunner* taskRunner() override { return nullptr; }
140 141
141 double m_time; 142 double m_time;
142 Task* m_currentTask; 143 Task* m_currentTask;
143 }; 144 };
144 145
145 class MockTimer : public TaskRunnerTimer<ImageQualityController> { 146 class MockTimer : public TaskRunnerTimer<ImageQualityController> {
146 public: 147 public:
147 using TimerFiredFunction = typename TaskRunnerTimer<ImageQualityController>: :TimerFiredFunction; 148 using TimerFiredFunction = typename TaskRunnerTimer<ImageQualityController>: :TimerFiredFunction;
148 149
149 MockTimer(ImageQualityController* o, TimerFiredFunction f) 150 MockTimer(ImageQualityController* o, TimerFiredFunction f)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // This animation is far enough in the future to make the timer restart, sin ce it is half over. 272 // This animation is far enough in the future to make the timer restart, sin ce it is half over.
272 nextTime = 0.1 + ImageQualityController::cTimerRestartThreshold + 0.01; 273 nextTime = 0.1 + ImageQualityController::cTimerRestartThreshold + 0.01;
273 EXPECT_EQ(true, controller()->shouldPaintAtLowQuality(*img, testImage.get(), testImage.get(), LayoutSize(4, 4), nextTime)); 274 EXPECT_EQ(true, controller()->shouldPaintAtLowQuality(*img, testImage.get(), testImage.get(), LayoutSize(4, 4), nextTime));
274 // Now the timer has restarted, leading to a larger fire interval. 275 // Now the timer has restarted, leading to a larger fire interval.
275 EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold, mockTimer->nextF ireInterval()); 276 EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold, mockTimer->nextF ireInterval());
276 } 277 }
277 278
278 #endif 279 #endif
279 280
280 } // namespace blink 281 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698