| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/layout/ImageQualityController.h" | 6 #include "core/layout/ImageQualityController.h" |
| 7 | 7 |
| 8 #include "core/layout/LayoutImage.h" | 8 #include "core/layout/LayoutImage.h" |
| 9 #include "core/layout/LayoutTestHelper.h" | 9 #include "core/layout/LayoutTestHelper.h" |
| 10 #include "platform/graphics/GraphicsContext.h" | 10 #include "platform/graphics/GraphicsContext.h" |
| 11 #include "platform/graphics/paint/DisplayItemList.h" | 11 #include "platform/graphics/paint/DisplayItemList.h" |
| 12 | 12 |
| 13 #include <gtest/gtest.h> | 13 #include <gtest/gtest.h> |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class ImageQualityControllerTest : public RenderingTest { | 17 class ImageQualityControllerTest : public RenderingTest { |
| 18 protected: | 18 protected: |
| 19 ImageQualityController* controller() { return m_controller; } | 19 ImageQualityController* controller() { return m_controller; } |
| 20 | 20 |
| 21 private: | 21 private: |
| 22 virtual void SetUp() override | 22 void SetUp() override |
| 23 { | 23 { |
| 24 m_controller = ImageQualityController::imageQualityController(); | 24 m_controller = ImageQualityController::imageQualityController(); |
| 25 RenderingTest::SetUp(); | 25 RenderingTest::SetUp(); |
| 26 } | 26 } |
| 27 virtual void TearDown() override | 27 void TearDown() override |
| 28 { | 28 { |
| 29 } | 29 } |
| 30 ImageQualityController* m_controller; | 30 ImageQualityController* m_controller; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 TEST_F(ImageQualityControllerTest, RegularImage) | 33 TEST_F(ImageQualityControllerTest, RegularImage) |
| 34 { | 34 { |
| 35 setBodyInnerHTML("<img src='myimage'></img>"); | 35 setBodyInnerHTML("<img src='myimage'></img>"); |
| 36 LayoutObject* obj = document().body()->firstChild()->layoutObject(); | 36 LayoutObject* obj = document().body()->firstChild()->layoutObject(); |
| 37 | 37 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 EXPECT_FALSE(mockTimer->isActive()); | 204 EXPECT_FALSE(mockTimer->isActive()); |
| 205 // Painted at the same size, so even though timer is still executing, don't
go to low quality. | 205 // Painted at the same size, so even though timer is still executing, don't
go to low quality. |
| 206 EXPECT_EQ(InterpolationLow, controller()->chooseInterpolationQuality(&contex
t, img, testImage.get(), testImage.get(), LayoutSize(4, 4))); | 206 EXPECT_EQ(InterpolationLow, controller()->chooseInterpolationQuality(&contex
t, img, testImage.get(), testImage.get(), LayoutSize(4, 4))); |
| 207 // Check that the timer was not kicked. It should not have been, since the i
mage was painted at the same size as last time. | 207 // Check that the timer was not kicked. It should not have been, since the i
mage was painted at the same size as last time. |
| 208 EXPECT_FALSE(mockTimer->isActive()); | 208 EXPECT_FALSE(mockTimer->isActive()); |
| 209 } | 209 } |
| 210 | 210 |
| 211 #endif | 211 #endif |
| 212 | 212 |
| 213 } // namespace blink | 213 } // namespace blink |
| OLD | NEW |