Index: Source/web/tests/WebFrameTest.cpp |
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp |
index 4a3f112917626400b361734eda6193e2b88165a5..de6a02718ed84ceb70f1f69e1c535dde4c9aa2cc 100644 |
--- a/Source/web/tests/WebFrameTest.cpp |
+++ b/Source/web/tests/WebFrameTest.cpp |
@@ -7022,6 +7022,38 @@ TEST_F(WebFrameSwapTest, SwapMainFrame) |
remoteFrame->close(); |
} |
+namespace { |
+ |
+class SwapMainFrameWhenTitleChangesWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |
+public: |
+ SwapMainFrameWhenTitleChangesWebFrameClient() {} |
+ ~SwapMainFrameWhenTitleChangesWebFrameClient() override {} |
+ |
+ void didReceiveTitle(WebLocalFrame* frame, const WebString& title, WebTextDirection direction) override |
Nate Chapin
2015/09/04 18:30:47
Style nit: drop the unused variable names.
sky
2015/09/04 18:57:13
Done.
|
+ { |
+ if (!frame->parent()) |
+ frame->swap(WebRemoteFrame::create(WebTreeScopeType::Document, nullptr)); |
+ } |
+ |
+private: |
Nate Chapin
2015/09/04 18:30:47
Nit: remove this
sky
2015/09/04 18:57:13
Done.
|
+}; |
+ |
+} // 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); |