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

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

Issue 1041473002: Detach old frame on WebFrame::swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « Source/core/page/Page.cpp ('k') | Source/web/AssertMatchingEnums.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "core/page/PrintContext.h" 6 #include "core/page/PrintContext.h"
7 7
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/frame/FrameHost.h" 9 #include "core/frame/FrameHost.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 327
328 printSinglePage(canvas); 328 printSinglePage(canvas);
329 329
330 const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations( ); 330 const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations( );
331 ASSERT_EQ(2u, operations.size()); 331 ASSERT_EQ(2u, operations.size());
332 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); 332 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type);
333 EXPECT_SKRECT_EQ(250, 260, 170, 180, operations[0].rect); 333 EXPECT_SKRECT_EQ(250, 260, 170, 180, operations[0].rect);
334 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); 334 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type);
335 EXPECT_SKRECT_EQ(350, 360, 270, 280, operations[1].rect); 335 EXPECT_SKRECT_EQ(350, 360, 270, 280, operations[1].rect);
336 336
337 subframe->detach(); 337 subframe->detach(FrameDetachType::Remove);
338 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(nullptr); 338 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(nullptr);
339 document().frame()->host()->decrementSubframeCount(); 339 document().frame()->host()->decrementSubframeCount();
340 } 340 }
341 341
342 TEST_F(PrintContextFrameTest, WithScrolledSubframe) 342 TEST_F(PrintContextFrameTest, WithScrolledSubframe)
343 { 343 {
344 MockCanvas canvas; 344 MockCanvas canvas;
345 document().setBaseURLOverride(KURL(ParsedURLString, "http://a.com/")); 345 document().setBaseURLOverride(KURL(ParsedURLString, "http://a.com/"));
346 setBodyInnerHTML("<style>::-webkit-scrollbar { display: none }</style>" 346 setBodyInnerHTML("<style>::-webkit-scrollbar { display: none }</style>"
347 "<iframe id='frame' src='http://b.com/' width='500' height='500'" 347 "<iframe id='frame' src='http://b.com/' width='500' height='500'"
(...skipping 22 matching lines...) Expand all
370 370
371 const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations( ); 371 const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations( );
372 ASSERT_EQ(3u, operations.size()); 372 ASSERT_EQ(3u, operations.size());
373 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); 373 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type);
374 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); // FIXME: the rect sho uld be clipped. 374 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); // FIXME: the rect sho uld be clipped.
375 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); 375 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type);
376 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); 376 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect);
377 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); 377 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type);
378 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); 378 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect);
379 379
380 subframe->detach(); 380 subframe->detach(FrameDetachType::Remove);
381 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(nullptr); 381 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(nullptr);
382 document().frame()->host()->decrementSubframeCount(); 382 document().frame()->host()->decrementSubframeCount();
383 } 383 }
384 384
385 } // namespace blink 385 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/Page.cpp ('k') | Source/web/AssertMatchingEnums.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698