| 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 "core/page/PrintContext.h" | 5 #include "core/page/PrintContext.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 const Vector<Operation>& recordedOperations() const { | 66 const Vector<Operation>& recordedOperations() const { |
| 67 return m_recordedOperations; | 67 return m_recordedOperations; |
| 68 } | 68 } |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 Vector<Operation> m_recordedOperations; | 71 Vector<Operation> m_recordedOperations; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 class PrintContextTest : public RenderingTest { | 74 class PrintContextTest : public RenderingTest { |
| 75 protected: | 75 protected: |
| 76 explicit PrintContextTest(FrameLoaderClient* frameLoaderClient = nullptr) | 76 explicit PrintContextTest(LocalFrameClient* localFrameClient = nullptr) |
| 77 : RenderingTest(frameLoaderClient) {} | 77 : RenderingTest(localFrameClient) {} |
| 78 | 78 |
| 79 void SetUp() override { | 79 void SetUp() override { |
| 80 RenderingTest::SetUp(); | 80 RenderingTest::SetUp(); |
| 81 m_printContext = new MockPrintContext(document().frame()); | 81 m_printContext = new MockPrintContext(document().frame()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 MockPrintContext& printContext() { return *m_printContext.get(); } | 84 MockPrintContext& printContext() { return *m_printContext.get(); } |
| 85 | 85 |
| 86 void setBodyInnerHTML(String bodyContent) { | 86 void setBodyInnerHTML(String bodyContent) { |
| 87 document().body()->setAttribute(HTMLNames::styleAttr, "margin: 0"); | 87 document().body()->setAttribute(HTMLNames::styleAttr, "margin: 0"); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); | 351 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); |
| 352 EXPECT_SKRECT_EQ(50, 60, 70, 80, | 352 EXPECT_SKRECT_EQ(50, 60, 70, 80, |
| 353 operations[0].rect); // FIXME: the rect should be clipped. | 353 operations[0].rect); // FIXME: the rect should be clipped. |
| 354 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); | 354 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); |
| 355 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); | 355 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); |
| 356 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); | 356 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); |
| 357 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); | 357 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); |
| 358 } | 358 } |
| 359 | 359 |
| 360 } // namespace blink | 360 } // namespace blink |
| OLD | NEW |