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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 1302333003: Adds test coverage for 521663 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: nits and merge Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/web/tests/data/frame-a-b-c.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 70e662429ce313e0ee97e79ff60ea38a95dbb9d2..a250276f3fdbfc71224549eabac3aa9de77c2e51 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -7043,6 +7043,36 @@ TEST_F(WebFrameSwapTest, SwapMainFrame)
remoteFrame->close();
}
+namespace {
+
+class SwapMainFrameWhenTitleChangesWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
+public:
+ SwapMainFrameWhenTitleChangesWebFrameClient() {}
+ ~SwapMainFrameWhenTitleChangesWebFrameClient() override {}
+
+ void didReceiveTitle(WebLocalFrame* frame, const WebString&, WebTextDirection) override
+ {
+ if (!frame->parent())
+ frame->swap(WebRemoteFrame::create(WebTreeScopeType::Document, nullptr));
+ }
+};
+
+} // anonymous namespace
+
+TEST_F(WebFrameTest, SwapMainFrameWhileLoading)
+{
+ SwapMainFrameWhenTitleChangesWebFrameClient frameClient;
+
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ registerMockedHttpURLLoad("frame-a-b-c.html");
+ registerMockedHttpURLLoad("subframe-a.html");
+ registerMockedHttpURLLoad("subframe-b.html");
+ registerMockedHttpURLLoad("subframe-c.html");
+ registerMockedHttpURLLoad("subframe-hello.html");
+
+ webViewHelper.initializeAndLoad(m_baseURL + "frame-a-b-c.html", true, &frameClient);
+}
+
void swapAndVerifyFirstChildConsistency(const char* const message, WebFrame* parent, WebFrame* newChild)
{
SCOPED_TRACE(message);
« no previous file with comments | « no previous file | Source/web/tests/data/frame-a-b-c.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698