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

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

Issue 2013573003: Use EXPECT_FALSE instead of EXPECT_EQ(false to fix linux build with gcc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 { 247 {
248 MockTimer* mockTimer = new MockTimer(controller(), &ImageQualityController:: highQualityRepaintTimerFired); 248 MockTimer* mockTimer = new MockTimer(controller(), &ImageQualityController:: highQualityRepaintTimerFired);
249 controller()->setTimer(mockTimer); 249 controller()->setTimer(mockTimer);
250 setBodyInnerHTML("<img src='myimage'></img>"); 250 setBodyInnerHTML("<img src='myimage'></img>");
251 LayoutImage* img = toLayoutImage(document().body()->firstChild()->layoutObje ct()); 251 LayoutImage* img = toLayoutImage(document().body()->firstChild()->layoutObje ct());
252 252
253 RefPtr<TestImageLowQuality> testImage = adoptRef(new TestImageLowQuality); 253 RefPtr<TestImageLowQuality> testImage = adoptRef(new TestImageLowQuality);
254 254
255 // Paint once. This will kick off a timer to see if we resize it during that timer's execution. 255 // Paint once. This will kick off a timer to see if we resize it during that timer's execution.
256 mockTimer->setTime(0.1); 256 mockTimer->setTime(0.1);
257 EXPECT_EQ(false, controller()->shouldPaintAtLowQuality(*img, testImage.get() , testImage.get(), LayoutSize(2, 2), 0.1)); 257 EXPECT_FALSE(controller()->shouldPaintAtLowQuality(*img, testImage.get(), te stImage.get(), LayoutSize(2, 2), 0.1));
258 EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold, mockTimer->nextF ireInterval()); 258 EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold, mockTimer->nextF ireInterval());
259 259
260 // Go into low-quality mode now that the size changed. 260 // Go into low-quality mode now that the size changed.
261 double nextTime = 0.1 + ImageQualityController::cTimerRestartThreshold / 2.0 ; 261 double nextTime = 0.1 + ImageQualityController::cTimerRestartThreshold / 2.0 ;
262 mockTimer->setTime(nextTime); 262 mockTimer->setTime(nextTime);
263 EXPECT_EQ(true, controller()->shouldPaintAtLowQuality(*img, testImage.get(), testImage.get(), LayoutSize(3, 3), nextTime)); 263 EXPECT_EQ(true, controller()->shouldPaintAtLowQuality(*img, testImage.get(), testImage.get(), LayoutSize(3, 3), nextTime));
264 // The fire interval has decreased, because we have not restarted the timer. 264 // The fire interval has decreased, because we have not restarted the timer.
265 EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold - ImageQualityCon troller::cTimerRestartThreshold / 2.0, mockTimer->nextFireInterval()); 265 EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold - ImageQualityCon troller::cTimerRestartThreshold / 2.0, mockTimer->nextFireInterval());
266 266
267 // This animation is far enough in the future to make the timer restart, sin ce it is half over. 267 // This animation is far enough in the future to make the timer restart, sin ce it is half over.
268 nextTime = 0.1 + ImageQualityController::cTimerRestartThreshold + 0.01; 268 nextTime = 0.1 + ImageQualityController::cTimerRestartThreshold + 0.01;
269 EXPECT_EQ(true, controller()->shouldPaintAtLowQuality(*img, testImage.get(), testImage.get(), LayoutSize(4, 4), nextTime)); 269 EXPECT_EQ(true, controller()->shouldPaintAtLowQuality(*img, testImage.get(), testImage.get(), LayoutSize(4, 4), nextTime));
270 // Now the timer has restarted, leading to a larger fire interval. 270 // Now the timer has restarted, leading to a larger fire interval.
271 EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold, mockTimer->nextF ireInterval()); 271 EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold, mockTimer->nextF ireInterval());
272 } 272 }
273 273
274 #endif 274 #endif
275 275
276 } // namespace blink 276 } // namespace blink
OLDNEW
« no previous file with comments | « chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698