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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 EXPECT_GE(90, operations[1].rect.y()); | 249 EXPECT_GE(90, operations[1].rect.y()); |
250 } | 250 } |
251 | 251 |
252 TEST_F(PrintContextTest, LinkedTarget) { | 252 TEST_F(PrintContextTest, LinkedTarget) { |
253 MockCanvas canvas; | 253 MockCanvas canvas; |
254 document().setBaseURLOverride(KURL(ParsedURLString, "http://a.com/")); | 254 document().setBaseURLOverride(KURL(ParsedURLString, "http://a.com/")); |
255 setBodyInnerHTML( | 255 setBodyInnerHTML( |
256 absoluteBlockHtmlForLink( | 256 absoluteBlockHtmlForLink( |
257 50, 60, 70, 80, | 257 50, 60, 70, 80, |
258 "#fragment") // Generates a Link_Named_Dest_Key annotation | 258 "#fragment") // Generates a Link_Named_Dest_Key annotation |
259 + absoluteBlockHtmlForLink(150, 160, 170, 180, | 259 + |
260 "#not-found") // Generates no annotation | 260 absoluteBlockHtmlForLink(150, 160, 170, 180, |
| 261 "#not-found") // Generates no annotation |
261 + | 262 + |
262 htmlForAnchor(250, 260, "fragment", | 263 htmlForAnchor(250, 260, "fragment", |
263 "fragment") // Generates a Define_Named_Dest_Key annotation | 264 "fragment") // Generates a Define_Named_Dest_Key annotation |
264 + htmlForAnchor(350, 360, "fragment-not-used", | 265 + |
265 "fragment-not-used")); // Generates no annotation | 266 htmlForAnchor(350, 360, "fragment-not-used", |
| 267 "fragment-not-used")); // Generates no annotation |
266 printSinglePage(canvas); | 268 printSinglePage(canvas); |
267 | 269 |
268 const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations(); | 270 const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations(); |
269 ASSERT_EQ(2u, operations.size()); | 271 ASSERT_EQ(2u, operations.size()); |
270 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); | 272 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); |
271 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); | 273 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); |
272 EXPECT_EQ(MockCanvas::DrawPoint, operations[1].type); | 274 EXPECT_EQ(MockCanvas::DrawPoint, operations[1].type); |
273 EXPECT_SKRECT_EQ(250, 260, 0, 0, operations[1].rect); | 275 EXPECT_SKRECT_EQ(250, 260, 0, 0, operations[1].rect); |
274 } | 276 } |
275 | 277 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); | 353 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); |
352 EXPECT_SKRECT_EQ(50, 60, 70, 80, | 354 EXPECT_SKRECT_EQ(50, 60, 70, 80, |
353 operations[0].rect); // FIXME: the rect should be clipped. | 355 operations[0].rect); // FIXME: the rect should be clipped. |
354 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); | 356 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); |
355 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); | 357 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); |
356 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); | 358 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); |
357 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); | 359 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); |
358 } | 360 } |
359 | 361 |
360 } // namespace blink | 362 } // namespace blink |
OLD | NEW |