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

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: Another GYP fix Created 4 years, 5 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 void postDelayedTask(const WebTraceLocation&, Task* task, double) override 128 void postDelayedTask(const WebTraceLocation&, Task* task, double) override
129 { 129 {
130 if (m_currentTask) 130 if (m_currentTask)
131 delete m_currentTask; 131 delete m_currentTask;
132 m_currentTask = task; 132 m_currentTask = task;
133 133
134 } 134 }
135 WebTaskRunner* clone() override { return nullptr; } 135 WebTaskRunner* clone() override { return nullptr; }
136 double virtualTimeSeconds() const override { return 0.0; } 136 double virtualTimeSeconds() const override { return 0.0; }
137 double monotonicallyIncreasingVirtualTimeSeconds() const override { return m _time; } 137 double monotonicallyIncreasingVirtualTimeSeconds() const override { return m _time; }
138 scoped_refptr<base::SingleThreadTaskRunner> taskRunner() override { return n ullptr; }
138 139
139 double m_time; 140 double m_time;
140 Task* m_currentTask; 141 Task* m_currentTask;
141 }; 142 };
142 143
143 class MockTimer : public Timer<ImageQualityController> { 144 class MockTimer : public Timer<ImageQualityController> {
144 typedef void (ImageQualityController::*TimerFiredFunction)(Timer*); 145 typedef void (ImageQualityController::*TimerFiredFunction)(Timer*);
145 public: 146 public:
146 MockTimer(ImageQualityController* o, TimerFiredFunction f) 147 MockTimer(ImageQualityController* o, TimerFiredFunction f)
147 : Timer<ImageQualityController>(o, f, &m_taskRunner) 148 : Timer<ImageQualityController>(o, f, &m_taskRunner)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // This animation is far enough in the future to make the timer restart, sin ce it is half over. 269 // This animation is far enough in the future to make the timer restart, sin ce it is half over.
269 nextTime = 0.1 + ImageQualityController::cTimerRestartThreshold + 0.01; 270 nextTime = 0.1 + ImageQualityController::cTimerRestartThreshold + 0.01;
270 EXPECT_EQ(true, controller()->shouldPaintAtLowQuality(*img, testImage.get(), testImage.get(), LayoutSize(4, 4), nextTime)); 271 EXPECT_EQ(true, controller()->shouldPaintAtLowQuality(*img, testImage.get(), testImage.get(), LayoutSize(4, 4), nextTime));
271 // Now the timer has restarted, leading to a larger fire interval. 272 // Now the timer has restarted, leading to a larger fire interval.
272 EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold, mockTimer->nextF ireInterval()); 273 EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold, mockTimer->nextF ireInterval());
273 } 274 }
274 275
275 #endif 276 #endif
276 277
277 } // namespace blink 278 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698