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

Side by Side Diff: Source/web/tests/WebFrameTest.cpp

Issue 655063003: Disconnect frame owners when detaching frames. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on top of frame detach streamlining and add a test Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLFrameOwnerElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 6487 matching lines...) Expand 10 before | Expand all | Expand 10 after
6498 EXPECT_TRUE(client.didNotify()); 6498 EXPECT_TRUE(client.didNotify());
6499 EXPECT_EQ(0xff0000ff, frame->document().themeColor()); 6499 EXPECT_EQ(0xff0000ff, frame->document().themeColor());
6500 // Change of second theme-color meta tag will not change frame's theme 6500 // Change of second theme-color meta tag will not change frame's theme
6501 // color. 6501 // color.
6502 client.reset(); 6502 client.reset();
6503 frame->executeScript(WebScriptSource("document.getElementById('tc2').setAttr ibute('content', '#00FF00');")); 6503 frame->executeScript(WebScriptSource("document.getElementById('tc2').setAttr ibute('content', '#00FF00');"));
6504 EXPECT_TRUE(client.didNotify()); 6504 EXPECT_TRUE(client.didNotify());
6505 EXPECT_EQ(0xff0000ff, frame->document().themeColor()); 6505 EXPECT_EQ(0xff0000ff, frame->document().themeColor());
6506 } 6506 }
6507 6507
6508 // Make sure that an embedder-triggered detach with a remote frame parent
6509 // doesn't leave behind dangling pointers.
6510 TEST_F(WebFrameTest, EmbedderTriggeredDetachWithRemoteMainFrame)
6511 {
6512 // FIXME: Refactor some of this logic into WebViewHelper to make it easier t o
6513 // write tests with a top-level remote frame.
6514 FrameTestHelpers::TestWebViewClient viewClient;
6515 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
6516 WebView* view = WebView::create(&viewClient);
6517 view->setMainFrame(WebRemoteFrame::create(&remoteClient));
6518 FrameTestHelpers::TestWebFrameClient childFrameClient;
6519 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc alChild("", &childFrameClient);
6520
6521 // Purposely keep the LocalFrame alive so it's the last thing to be destroye d.
6522 RefPtr<Frame> childCoreFrame = toCoreFrame(childFrame);
6523 view->close();
6524 childCoreFrame.clear();
6525 }
6526
6508 class WebFrameSwapTest : public WebFrameTest { 6527 class WebFrameSwapTest : public WebFrameTest {
6509 protected: 6528 protected:
6510 WebFrameSwapTest() 6529 WebFrameSwapTest()
6511 { 6530 {
6512 registerMockedHttpURLLoad("frame-a-b-c.html"); 6531 registerMockedHttpURLLoad("frame-a-b-c.html");
6513 registerMockedHttpURLLoad("subframe-a.html"); 6532 registerMockedHttpURLLoad("subframe-a.html");
6514 registerMockedHttpURLLoad("subframe-b.html"); 6533 registerMockedHttpURLLoad("subframe-b.html");
6515 registerMockedHttpURLLoad("subframe-c.html"); 6534 registerMockedHttpURLLoad("subframe-c.html");
6516 registerMockedHttpURLLoad("subframe-hello.html"); 6535 registerMockedHttpURLLoad("subframe-hello.html");
6517 6536
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
6782 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); 6801 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount());
6783 6802
6784 // Neither should a page reload. 6803 // Neither should a page reload.
6785 localFrame->reload(); 6804 localFrame->reload();
6786 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); 6805 EXPECT_EQ(4u, frameClient.provisionalLoadCount());
6787 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); 6806 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition());
6788 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); 6807 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount());
6789 } 6808 }
6790 6809
6791 } // namespace 6810 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFrameOwnerElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698