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

Side by Side Diff: third_party/WebKit/Source/core/page/PrintContextTest.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (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
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/page/PrintContext.h" 5 #include "core/page/PrintContext.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/html/HTMLElement.h" 9 #include "core/html/HTMLElement.h"
10 #include "core/layout/LayoutTestHelper.h" 10 #include "core/layout/LayoutTestHelper.h"
11 #include "core/layout/LayoutView.h" 11 #include "core/layout/LayoutView.h"
12 #include "core/paint/PaintLayer.h" 12 #include "core/paint/PaintLayer.h"
13 #include "core/paint/PaintLayerPainter.h" 13 #include "core/paint/PaintLayerPainter.h"
14 #include "core/testing/DummyPageHolder.h" 14 #include "core/testing/DummyPageHolder.h"
15 #include "platform/graphics/GraphicsContext.h" 15 #include "platform/graphics/GraphicsContext.h"
16 #include "platform/graphics/paint/DrawingRecorder.h" 16 #include "platform/graphics/paint/DrawingRecorder.h"
17 #include "platform/graphics/paint/SkPictureBuilder.h" 17 #include "platform/graphics/paint/SkPictureBuilder.h"
18 #include "platform/scroll/ScrollbarTheme.h" 18 #include "platform/scroll/ScrollbarTheme.h"
19 #include "platform/text/TextStream.h" 19 #include "platform/text/TextStream.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 #include "third_party/skia/include/core/SkCanvas.h" 21 #include "third_party/skia/include/core/SkCanvas.h"
22 #include <memory>
23 22
24 namespace blink { 23 namespace blink {
25 24
26 const int kPageWidth = 800; 25 const int kPageWidth = 800;
27 const int kPageHeight = 600; 26 const int kPageHeight = 600;
28 27
29 class MockPrintContext : public PrintContext { 28 class MockPrintContext : public PrintContext {
30 public: 29 public:
31 MockPrintContext(LocalFrame* frame) : PrintContext(frame) { } 30 MockPrintContext(LocalFrame* frame) : PrintContext(frame) { }
32 31
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 121 }
123 122
124 static String htmlForAnchor(int x, int y, const char* name, const char* text Content) 123 static String htmlForAnchor(int x, int y, const char* name, const char* text Content)
125 { 124 {
126 TextStream ts; 125 TextStream ts;
127 ts << "<a name='" << name << "' style='position: absolute; left: " << x << "px; top: " << y << "px'>" << textContent << "</a>"; 126 ts << "<a name='" << name << "' style='position: absolute; left: " << x << "px; top: " << y << "px'>" << textContent << "</a>";
128 return ts.release(); 127 return ts.release();
129 } 128 }
130 129
131 private: 130 private:
132 std::unique_ptr<DummyPageHolder> m_pageHolder; 131 OwnPtr<DummyPageHolder> m_pageHolder;
133 Persistent<MockPrintContext> m_printContext; 132 Persistent<MockPrintContext> m_printContext;
134 }; 133 };
135 134
136 class PrintContextFrameTest : public PrintContextTest { 135 class PrintContextFrameTest : public PrintContextTest {
137 public: 136 public:
138 PrintContextFrameTest() : PrintContextTest(SingleChildFrameLoaderClient::cre ate()) { } 137 PrintContextFrameTest() : PrintContextTest(SingleChildFrameLoaderClient::cre ate()) { }
139 }; 138 };
140 139
141 #define EXPECT_SKRECT_EQ(expectedX, expectedY, expectedWidth, expectedHeight, ac tualRect) \ 140 #define EXPECT_SKRECT_EQ(expectedX, expectedY, expectedWidth, expectedHeight, ac tualRect) \
142 EXPECT_EQ(expectedX, actualRect.x()); \ 141 EXPECT_EQ(expectedX, actualRect.x()); \
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 ASSERT_EQ(3u, operations.size()); 322 ASSERT_EQ(3u, operations.size());
324 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); 323 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type);
325 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); // FIXME: the rect sho uld be clipped. 324 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); // FIXME: the rect sho uld be clipped.
326 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); 325 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type);
327 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); 326 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect);
328 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); 327 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type);
329 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); 328 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect);
330 } 329 }
331 330
332 } // namespace blink 331 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698