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

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

Issue 879423003: Move Location to DOMWindow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase, #include cleanup Created 5 years, 10 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 | « Source/core/frame/RemoteDOMWindow.cpp ('k') | no next file » | 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 ed37af9ec251f6c0a1fff35466be1896532ba67b..d9081192d76855dc6fcc34a615b441f5b75ac6a9 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -6740,7 +6740,7 @@ protected:
registerMockedHttpURLLoad("subframe-c.html");
registerMockedHttpURLLoad("subframe-hello.html");
- m_webViewHelper.initializeAndLoad(m_baseURL + "frame-a-b-c.html");
+ m_webViewHelper.initializeAndLoad(m_baseURL + "frame-a-b-c.html", true);
}
void reset() { m_webViewHelper.reset(); }
@@ -6960,6 +6960,41 @@ TEST_F(WebFrameSwapTest, HistoryCommitTypeAfterRemoteToLocalSwap)
remoteFrame->close();
}
+class RemoteNavigationClient : public FrameTestHelpers::TestWebRemoteFrameClient {
+public:
+ void navigate(const WebURLRequest& request, bool shouldReplaceCurrentEntry) override
+ {
+ m_lastRequest = request;
+ }
+
+ const WebURLRequest& lastRequest() const { return m_lastRequest; }
+
+private:
+ WebURLRequest m_lastRequest;
+};
+
+TEST_F(WebFrameSwapTest, NavigateRemoteFrameViaLocation)
+{
+ RemoteNavigationClient client;
+ WebRemoteFrame* remoteFrame = WebRemoteFrame::create(&client);
+ WebFrame* targetFrame = mainFrame()->firstChild();
+ ASSERT_TRUE(targetFrame);
+ targetFrame->swap(remoteFrame);
+ ASSERT_TRUE(mainFrame()->firstChild());
+ ASSERT_EQ(mainFrame()->firstChild(), remoteFrame);
+
+ remoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("http://127.0.0.1"));
+ mainFrame()->executeScript(WebScriptSource(
+ "document.getElementsByTagName('iframe')[0].contentWindow.location = 'data:text/html,hi'"));
+ ASSERT_FALSE(client.lastRequest().isNull());
+ EXPECT_EQ(WebURL(toKURL("data:text/html,hi")), client.lastRequest().url());
+
+ // Manually reset to break WebViewHelper's dependency on the stack allocated
+ // TestWebFrameClient.
+ reset();
+ remoteFrame->close();
+}
+
class MockDocumentThreadableLoaderClient : public DocumentThreadableLoaderClient {
public:
MockDocumentThreadableLoaderClient() : m_failed(false) { }
« no previous file with comments | « Source/core/frame/RemoteDOMWindow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698