Index: Source/web/tests/WebFrameTest.cpp |
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp |
index edf9a86ff32ccf5e848305e7d73f3b183716cf8a..8b22ea1c520fdb0823513a9c233e16e626c4744d 100644 |
--- a/Source/web/tests/WebFrameTest.cpp |
+++ b/Source/web/tests/WebFrameTest.cpp |
@@ -6525,10 +6525,28 @@ private: |
FrameTestHelpers::WebViewHelper m_webViewHelper; |
}; |
-// FIXME: We should have tests for main frame swaps, but it interacts poorly |
-// with the geolocation inspector agent, since the lifetime of the inspector |
-// agent is tied to the Page, but the inspector agent is created by the |
-// instantiation of the main frame. |
+TEST_F(WebFrameSwapTest, SwapMainFrame) |
+{ |
+ WebFrame* remoteFrame = WebRemoteFrame::create(0); |
+ mainFrame()->swap(remoteFrame); |
+ |
+ FrameTestHelpers::TestWebFrameClient client; |
+ WebFrame* localFrame = WebLocalFrame::create(&client); |
+ remoteFrame->swap(localFrame); |
+ |
+ // FIXME: This almost certainly fires more load events on the iframe element |
+ // than it should. |
Nate Chapin
2014/10/16 21:17:46
This comment seems out of place?
dcheng
2014/10/16 21:20:20
It's about the call to loadFrame() below... but I
Nate Chapin
2014/10/16 21:21:47
Well, maybe I'm missing something, but I don't see
dcheng
2014/10/16 21:23:22
Hm. Good point. I've removed this FIXME.
|
+ // Finally, make sure an embedder triggered load in the local frame swapped |
+ // back in works. |
+ FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); |
+ std::string content = localFrame->contentAsText(1024).utf8(); |
+ EXPECT_EQ("hello", content); |
+ |
+ // Manually reset to break WebViewHelper's dependency on the stack allocated |
+ // TestWebFrameClient. |
+ reset(); |
+ remoteFrame->close(); |
+} |
void swapAndVerifyFirstChildConsistency(const char* const message, WebFrame* parent, WebFrame* newChild) |
{ |