| Index: third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp b/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp
|
| index 01eeadfb7042bfa38a03e8257892d97c5bca4246..acbc01047c4214ac882442ad61b9e3212d299a30 100644
|
| --- a/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp
|
| @@ -32,8 +32,9 @@ TEST_F(ImageQualityControllerTest, RegularImage) {
|
| setBodyInnerHTML("<img src='myimage'></img>");
|
| LayoutObject* obj = document().body()->firstChild()->layoutObject();
|
|
|
| - EXPECT_EQ(InterpolationDefault, controller()->chooseInterpolationQuality(
|
| - *obj, nullptr, nullptr, LayoutSize()));
|
| + EXPECT_EQ(InterpolationDefault,
|
| + controller()->chooseInterpolationQuality(*obj, nullptr, nullptr,
|
| + LayoutSize()));
|
| }
|
|
|
| TEST_F(ImageQualityControllerTest, ImageRenderingPixelated) {
|
| @@ -41,8 +42,9 @@ TEST_F(ImageQualityControllerTest, ImageRenderingPixelated) {
|
| "<img src='myimage' style='image-rendering: pixelated'></img>");
|
| LayoutObject* obj = document().body()->firstChild()->layoutObject();
|
|
|
| - EXPECT_EQ(InterpolationNone, controller()->chooseInterpolationQuality(
|
| - *obj, nullptr, nullptr, LayoutSize()));
|
| + EXPECT_EQ(InterpolationNone,
|
| + controller()->chooseInterpolationQuality(*obj, nullptr, nullptr,
|
| + LayoutSize()));
|
| }
|
|
|
| #if !USE(LOW_QUALITY_IMAGE_INTERPOLATION)
|
| @@ -236,36 +238,42 @@ TEST_F(ImageQualityControllerTest,
|
|
|
| // Paint once. This will kick off a timer to see if we resize it during that
|
| // timer's execution.
|
| - EXPECT_EQ(InterpolationMedium, controller()->chooseInterpolationQuality(
|
| - *animatingImage, testImage.get(),
|
| - testImage.get(), LayoutSize(2, 2)));
|
| + EXPECT_EQ(
|
| + InterpolationMedium,
|
| + controller()->chooseInterpolationQuality(
|
| + *animatingImage, testImage.get(), testImage.get(), LayoutSize(2, 2)));
|
|
|
| // Go into low-quality mode now that the size changed.
|
| - EXPECT_EQ(InterpolationLow, controller()->chooseInterpolationQuality(
|
| - *animatingImage, testImage.get(),
|
| - testImage.get(), LayoutSize(3, 3)));
|
| + EXPECT_EQ(
|
| + InterpolationLow,
|
| + controller()->chooseInterpolationQuality(
|
| + *animatingImage, testImage.get(), testImage.get(), LayoutSize(3, 3)));
|
|
|
| // The non-animating image receives a medium-quality filter, even though the
|
| // other one is animating.
|
| - EXPECT_EQ(InterpolationMedium, controller()->chooseInterpolationQuality(
|
| - *nonAnimatingImage, testImage.get(),
|
| - testImage.get(), LayoutSize(4, 4)));
|
| + EXPECT_EQ(InterpolationMedium,
|
| + controller()->chooseInterpolationQuality(
|
| + *nonAnimatingImage, testImage.get(), testImage.get(),
|
| + LayoutSize(4, 4)));
|
|
|
| // Now the second image has animated, so it also gets painted with a
|
| // low-quality filter.
|
| - EXPECT_EQ(InterpolationLow, controller()->chooseInterpolationQuality(
|
| - *nonAnimatingImage, testImage.get(),
|
| - testImage.get(), LayoutSize(3, 3)));
|
| + EXPECT_EQ(InterpolationLow,
|
| + controller()->chooseInterpolationQuality(
|
| + *nonAnimatingImage, testImage.get(), testImage.get(),
|
| + LayoutSize(3, 3)));
|
|
|
| mockTimer->fire();
|
| // The timer fired before painting at another size, so this doesn't count as
|
| // animation. Therefore not painting at low quality for any image.
|
| - EXPECT_EQ(InterpolationMedium, controller()->chooseInterpolationQuality(
|
| - *animatingImage, testImage.get(),
|
| - testImage.get(), LayoutSize(4, 4)));
|
| - EXPECT_EQ(InterpolationMedium, controller()->chooseInterpolationQuality(
|
| - *nonAnimatingImage, testImage.get(),
|
| - testImage.get(), LayoutSize(4, 4)));
|
| + EXPECT_EQ(
|
| + InterpolationMedium,
|
| + controller()->chooseInterpolationQuality(
|
| + *animatingImage, testImage.get(), testImage.get(), LayoutSize(4, 4)));
|
| + EXPECT_EQ(InterpolationMedium,
|
| + controller()->chooseInterpolationQuality(
|
| + *nonAnimatingImage, testImage.get(), testImage.get(),
|
| + LayoutSize(4, 4)));
|
| }
|
|
|
| TEST_F(ImageQualityControllerTest,
|
| @@ -332,9 +340,10 @@ TEST_F(ImageQualityControllerTest, DontRestartTimerUnlessAdvanced) {
|
| // Go into low-quality mode now that the size changed.
|
| double nextTime = 0.1 + ImageQualityController::cTimerRestartThreshold / 2.0;
|
| mockTimer->setTime(nextTime);
|
| - EXPECT_EQ(true, controller()->shouldPaintAtLowQuality(
|
| - *img, testImage.get(), testImage.get(), LayoutSize(3, 3),
|
| - nextTime));
|
| + EXPECT_EQ(
|
| + true,
|
| + controller()->shouldPaintAtLowQuality(
|
| + *img, testImage.get(), testImage.get(), LayoutSize(3, 3), nextTime));
|
| // The fire interval has decreased, because we have not restarted the timer.
|
| EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold -
|
| ImageQualityController::cTimerRestartThreshold / 2.0,
|
| @@ -343,9 +352,10 @@ TEST_F(ImageQualityControllerTest, DontRestartTimerUnlessAdvanced) {
|
| // This animation is far enough in the future to make the timer restart, since
|
| // it is half over.
|
| nextTime = 0.1 + ImageQualityController::cTimerRestartThreshold + 0.01;
|
| - EXPECT_EQ(true, controller()->shouldPaintAtLowQuality(
|
| - *img, testImage.get(), testImage.get(), LayoutSize(4, 4),
|
| - nextTime));
|
| + EXPECT_EQ(
|
| + true,
|
| + controller()->shouldPaintAtLowQuality(
|
| + *img, testImage.get(), testImage.get(), LayoutSize(4, 4), nextTime));
|
| // Now the timer has restarted, leading to a larger fire interval.
|
| EXPECT_EQ(ImageQualityController::cLowQualityTimeThreshold,
|
| mockTimer->nextFireInterval());
|
|
|