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

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: tests and cleanup 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
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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 printSinglePage(canvas); 321 printSinglePage(canvas);
322 322
323 const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations( ); 323 const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations( );
324 ASSERT_EQ(2u, operations.size()); 324 ASSERT_EQ(2u, operations.size());
325 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); 325 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type);
326 EXPECT_SKRECT_EQ(250, 260, 170, 180, operations[0].rect); 326 EXPECT_SKRECT_EQ(250, 260, 170, 180, operations[0].rect);
327 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); 327 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type);
328 EXPECT_SKRECT_EQ(350, 360, 270, 280, operations[1].rect); 328 EXPECT_SKRECT_EQ(350, 360, 270, 280, operations[1].rect);
329 329
330 subframe->detach(); 330 subframe->detach(DetachType::Remove);
331 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(nullptr); 331 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(nullptr);
332 document().frame()->host()->decrementSubframeCount(); 332 document().frame()->host()->decrementSubframeCount();
333 } 333 }
334 334
335 TEST_F(PrintContextFrameTest, WithScrolledSubframe) 335 TEST_F(PrintContextFrameTest, WithScrolledSubframe)
336 { 336 {
337 MockCanvas canvas; 337 MockCanvas canvas;
338 document().setBaseURLOverride(KURL(ParsedURLString, "http://a.com/")); 338 document().setBaseURLOverride(KURL(ParsedURLString, "http://a.com/"));
339 setBodyInnerHTML("<style>::-webkit-scrollbar { display: none }</style>" 339 setBodyInnerHTML("<style>::-webkit-scrollbar { display: none }</style>"
340 "<iframe id='frame' src='http://b.com/' width='500' height='500'" 340 "<iframe id='frame' src='http://b.com/' width='500' height='500'"
(...skipping 22 matching lines...) Expand all
363 363
364 const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations( ); 364 const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations( );
365 ASSERT_EQ(3u, operations.size()); 365 ASSERT_EQ(3u, operations.size());
366 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); 366 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type);
367 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); // FIXME: the rect sho uld be clipped. 367 EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); // FIXME: the rect sho uld be clipped.
368 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); 368 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type);
369 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); 369 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect);
370 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); 370 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type);
371 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); 371 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect);
372 372
373 subframe->detach(); 373 subframe->detach(DetachType::Remove);
374 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(nullptr); 374 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(nullptr);
375 document().frame()->host()->decrementSubframeCount(); 375 document().frame()->host()->decrementSubframeCount();
376 } 376 }
377 377
378 } // namespace blink 378 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698