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

Side by Side Diff: third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp

Issue 2631233003: Avoid mutating frame owner when detaching a provisional frame. (Closed)
Patch Set: Fix test to actually test the changed behavior. Created 3 years, 11 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 282
283 void WebViewHelper::resize(WebSize size) { 283 void WebViewHelper::resize(WebSize size) {
284 m_testWebViewClient->clearAnimationScheduled(); 284 m_testWebViewClient->clearAnimationScheduled();
285 webView()->resize(size); 285 webView()->resize(size);
286 EXPECT_FALSE(m_testWebViewClient->animationScheduled()); 286 EXPECT_FALSE(m_testWebViewClient->animationScheduled());
287 m_testWebViewClient->clearAnimationScheduled(); 287 m_testWebViewClient->clearAnimationScheduled();
288 } 288 }
289 289
290 TestWebFrameClient::TestWebFrameClient() {} 290 TestWebFrameClient::TestWebFrameClient() {}
291 291
292 // TODO(dcheng): https://crbug.com/578349 tracks the removal of this code. This
293 // override exists only to handle the confusing provisional frame case.
294 void TestWebFrameClient::frameDetached(WebLocalFrame* frame, DetachType type) {
295 if (type == DetachType::Remove && frame->parent()) {
296 // Since this may be detaching a provisional frame, make sure |child| is
297 // actually linked into the frame tree (i.e. it is present in its parent
298 // node's children list) before trying to remove it as a child.
299 for (WebFrame* child = frame->parent()->firstChild(); child;
300 child = child->nextSibling()) {
301 if (child == frame)
302 frame->parent()->removeChild(frame);
303 }
304 }
305
306 if (frame->frameWidget())
307 frame->frameWidget()->close();
308
309 frame->close();
310 }
311
292 WebLocalFrame* TestWebFrameClient::createChildFrame( 312 WebLocalFrame* TestWebFrameClient::createChildFrame(
293 WebLocalFrame* parent, 313 WebLocalFrame* parent,
294 WebTreeScopeType scope, 314 WebTreeScopeType scope,
295 const WebString& name, 315 const WebString& name,
296 const WebString& uniqueName, 316 const WebString& uniqueName,
297 WebSandboxFlags sandboxFlags, 317 WebSandboxFlags sandboxFlags,
298 const WebFrameOwnerProperties& frameOwnerProperties) { 318 const WebFrameOwnerProperties& frameOwnerProperties) {
299 WebLocalFrame* frame = WebLocalFrame::create(scope, this); 319 WebLocalFrame* frame = WebLocalFrame::create(scope, this);
300 parent->appendChild(frame); 320 parent->appendChild(frame);
301 return frame; 321 return frame;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 m_testWebViewClient->scheduleAnimation(); 354 m_testWebViewClient->scheduleAnimation();
335 } 355 }
336 356
337 void TestWebViewWidgetClient::didMeaningfulLayout( 357 void TestWebViewWidgetClient::didMeaningfulLayout(
338 WebMeaningfulLayout layoutType) { 358 WebMeaningfulLayout layoutType) {
339 m_testWebViewClient->didMeaningfulLayout(layoutType); 359 m_testWebViewClient->didMeaningfulLayout(layoutType);
340 } 360 }
341 361
342 } // namespace FrameTestHelpers 362 } // namespace FrameTestHelpers
343 } // namespace blink 363 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698