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

Unified Diff: third_party/WebKit/Source/core/paint/PaintInfoTest.cpp

Issue 1512803004: Use refs for GraphicsContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarTheme
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintInfoTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp b/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp
index 4163d2457e3a7f88149bcefc37804a8b4d0899fe..3824fd78853d69d2533e281ac315e52ea052bd07 100644
--- a/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintInfoTest.cpp
@@ -5,16 +5,25 @@
#include "config.h"
#include "core/paint/PaintInfo.h"
+#include "platform/graphics/paint/PaintController.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace blink {
class PaintInfoTest : public testing::Test {
+protected:
+ PaintInfoTest()
+ : m_paintController(PaintController::create())
+ , m_context(*m_paintController)
+ { }
+
+ OwnPtr<PaintController> m_paintController;
+ GraphicsContext m_context;
};
TEST_F(PaintInfoTest, intersectsCullRect)
{
- PaintInfo paintInfo(nullptr, IntRect(0, 0, 50, 50), PaintPhaseBlockBackground, GlobalPaintNormalPhase, PaintLayerNoFlag);
+ PaintInfo paintInfo(m_context, IntRect(0, 0, 50, 50), PaintPhaseBlockBackground, GlobalPaintNormalPhase, PaintLayerNoFlag);
EXPECT_TRUE(paintInfo.cullRect().intersectsCullRect(IntRect(0, 0, 1, 1)));
EXPECT_FALSE(paintInfo.cullRect().intersectsCullRect(IntRect(51, 51, 1, 1)));
@@ -22,7 +31,7 @@ TEST_F(PaintInfoTest, intersectsCullRect)
TEST_F(PaintInfoTest, intersectsCullRectWithLayoutRect)
{
- PaintInfo paintInfo(nullptr, IntRect(0, 0, 50, 50), PaintPhaseBlockBackground, GlobalPaintNormalPhase, PaintLayerNoFlag);
+ PaintInfo paintInfo(m_context, IntRect(0, 0, 50, 50), PaintPhaseBlockBackground, GlobalPaintNormalPhase, PaintLayerNoFlag);
EXPECT_TRUE(paintInfo.cullRect().intersectsCullRect(LayoutRect(0, 0, 1, 1)));
EXPECT_TRUE(paintInfo.cullRect().intersectsCullRect(LayoutRect(0.1, 0.1, 0.1, 0.1)));
@@ -30,7 +39,7 @@ TEST_F(PaintInfoTest, intersectsCullRectWithLayoutRect)
TEST_F(PaintInfoTest, intersectsCullRectWithTransform)
{
- PaintInfo paintInfo(nullptr, IntRect(0, 0, 50, 50), PaintPhaseBlockBackground, GlobalPaintNormalPhase, PaintLayerNoFlag);
+ PaintInfo paintInfo(m_context, IntRect(0, 0, 50, 50), PaintPhaseBlockBackground, GlobalPaintNormalPhase, PaintLayerNoFlag);
AffineTransform transform;
transform.translate(-2, -2);
@@ -40,7 +49,7 @@ TEST_F(PaintInfoTest, intersectsCullRectWithTransform)
TEST_F(PaintInfoTest, updateCullRect)
{
- PaintInfo paintInfo(nullptr, IntRect(1, 1, 50, 50), PaintPhaseBlockBackground, GlobalPaintNormalPhase, PaintLayerNoFlag);
+ PaintInfo paintInfo(m_context, IntRect(1, 1, 50, 50), PaintPhaseBlockBackground, GlobalPaintNormalPhase, PaintLayerNoFlag);
AffineTransform transform;
transform.translate(1, 1);
paintInfo.updateCullRect(transform);
@@ -51,7 +60,7 @@ TEST_F(PaintInfoTest, updateCullRect)
TEST_F(PaintInfoTest, intersectsVerticalRange)
{
- PaintInfo paintInfo(nullptr, IntRect(0, 0, 50, 100), PaintPhaseBlockBackground, GlobalPaintNormalPhase, PaintLayerNoFlag);
+ PaintInfo paintInfo(m_context, IntRect(0, 0, 50, 100), PaintPhaseBlockBackground, GlobalPaintNormalPhase, PaintLayerNoFlag);
EXPECT_TRUE(paintInfo.cullRect().intersectsVerticalRange(0, 1));
EXPECT_FALSE(paintInfo.cullRect().intersectsVerticalRange(100, 101));
@@ -59,7 +68,7 @@ TEST_F(PaintInfoTest, intersectsVerticalRange)
TEST_F(PaintInfoTest, intersectsHorizontalRange)
{
- PaintInfo paintInfo(nullptr, IntRect(0, 0, 50, 100), PaintPhaseBlockBackground, GlobalPaintNormalPhase, PaintLayerNoFlag);
+ PaintInfo paintInfo(m_context, IntRect(0, 0, 50, 100), PaintPhaseBlockBackground, GlobalPaintNormalPhase, PaintLayerNoFlag);
EXPECT_TRUE(paintInfo.cullRect().intersectsHorizontalRange(0, 1));
EXPECT_FALSE(paintInfo.cullRect().intersectsHorizontalRange(50, 51));
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintInfo.h ('k') | third_party/WebKit/Source/core/paint/PaintLayerPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698