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

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

Issue 2148363004: Use std::unique_ptr<> for WebTaskRunner::clone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 private: 126 private:
127 void postTask(const WebTraceLocation&, Task*) override { } 127 void postTask(const WebTraceLocation&, Task*) override { }
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 bool runsTasksOnCurrentThread() override { return true; } 135 bool runsTasksOnCurrentThread() override { return true; }
136 WebTaskRunner* clone() override { return nullptr; } 136 std::unique_ptr<WebTaskRunner> clone() override { return nullptr; }
137 double virtualTimeSeconds() const override { return 0.0; } 137 double virtualTimeSeconds() const override { return 0.0; }
138 double monotonicallyIncreasingVirtualTimeSeconds() const override { return m _time; } 138 double monotonicallyIncreasingVirtualTimeSeconds() const override { return m _time; }
139 139
140 double m_time; 140 double m_time;
141 Task* m_currentTask; 141 Task* m_currentTask;
142 }; 142 };
143 143
144 class MockTimer : public Timer<ImageQualityController> { 144 class MockTimer : public Timer<ImageQualityController> {
145 typedef void (ImageQualityController::*TimerFiredFunction)(Timer*); 145 typedef void (ImageQualityController::*TimerFiredFunction)(Timer*);
146 public: 146 public:
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // 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.
270 nextTime = 0.1 + ImageQualityController::cTimerRestartThreshold + 0.01; 270 nextTime = 0.1 + ImageQualityController::cTimerRestartThreshold + 0.01;
271 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));
272 // Now the timer has restarted, leading to a larger fire interval. 272 // Now the timer has restarted, leading to a larger fire interval.
273 EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold, mockTimer->nextF ireInterval()); 273 EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold, mockTimer->nextF ireInterval());
274 } 274 }
275 275
276 #endif 276 #endif
277 277
278 } // namespace blink 278 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698