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

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

Issue 1177313002: Revert of Fix Blink commit type for subframes after initial about:blank load. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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/web/WebLocalFrameImpl.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 8d2b9843267f3662d015d30e6716ad4eedc66509..9e48b3385b43c931398739f86008b1903ea39a11 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -5992,9 +5992,9 @@
WebFrame* m_frame;
};
-// Tests that the first navigation in an initially blank subframe will result in
-// a history entry being replaced and not a new one being added.
-TEST_P(ParameterizedWebFrameTest, FirstBlankSubframeNavigation)
+// Test which ensures that the first navigation in a subframe will always
+// result in history entry being replaced and not a new one added.
+TEST_P(ParameterizedWebFrameTest, DISABLED_FirstFrameNavigationReplacesHistory)
{
registerMockedHttpURLLoad("history.html");
registerMockedHttpURLLoad("find.html");
@@ -6002,56 +6002,40 @@
FrameTestHelpers::WebViewHelper webViewHelper(this);
TestHistoryWebFrameClient client;
webViewHelper.initializeAndLoad("about:blank", true, &client);
+ EXPECT_TRUE(client.replacesCurrentHistoryItem());
WebFrame* frame = webViewHelper.webView()->mainFrame();
- frame->executeScript(WebScriptSource(WebString::fromUTF8(
- "document.body.appendChild(document.createElement('iframe'))")));
-
+ FrameTestHelpers::loadFrame(frame,
+ "javascript:document.body.appendChild(document.createElement('iframe'))");
WebFrame* iframe = frame->firstChild();
- ASSERT_EQ(&client, toWebLocalFrameImpl(iframe)->client());
- EXPECT_EQ(iframe, client.frame());
-
- std::string url1 = m_baseURL + "history.html";
- FrameTestHelpers::loadFrame(iframe, url1);
- EXPECT_EQ(iframe, client.frame());
- EXPECT_EQ(url1, iframe->document().url().string().utf8());
+ EXPECT_EQ(client.frame(), iframe);
EXPECT_TRUE(client.replacesCurrentHistoryItem());
- std::string url2 = m_baseURL + "find.html";
- FrameTestHelpers::loadFrame(iframe, url2);
- EXPECT_EQ(iframe, client.frame());
- EXPECT_EQ(url2, iframe->document().url().string().utf8());
+ FrameTestHelpers::loadFrame(frame,
+ "javascript:window.frames[0].location.assign('" + m_baseURL + "history.html')");
+ EXPECT_EQ(client.frame(), iframe);
+ EXPECT_TRUE(client.replacesCurrentHistoryItem());
+
+ FrameTestHelpers::loadFrame(frame,
+ "javascript:window.frames[0].location.assign('" + m_baseURL + "find.html')");
+ EXPECT_EQ(client.frame(), iframe);
EXPECT_FALSE(client.replacesCurrentHistoryItem());
-}
-
-// Tests that a navigation in a frame with a non-blank initial URL will create
-// a new history item, unlike the case above.
-TEST_P(ParameterizedWebFrameTest, FirstNonBlankSubframeNavigation)
-{
- registerMockedHttpURLLoad("history.html");
- registerMockedHttpURLLoad("find.html");
-
- FrameTestHelpers::WebViewHelper webViewHelper(this);
- TestHistoryWebFrameClient client;
- webViewHelper.initializeAndLoad("about:blank", true, &client);
-
- WebFrame* frame = webViewHelper.webView()->mainFrame();
-
- std::string url1 = m_baseURL + "history.html";
+
+ // Repeat the test, but start out the iframe with initial URL, which is not
+ // "about:blank".
FrameTestHelpers::loadFrame(frame,
"javascript:var f = document.createElement('iframe'); "
- "f.src = '" + url1 + "';"
+ "f.src = '" + m_baseURL + "history.html';"
"document.body.appendChild(f)");
- WebFrame* iframe = frame->firstChild();
- EXPECT_EQ(iframe, client.frame());
- EXPECT_EQ(url1, iframe->document().url().string().utf8());
-
- std::string url2 = m_baseURL + "find.html";
- FrameTestHelpers::loadFrame(iframe, url2);
- EXPECT_EQ(iframe, client.frame());
- EXPECT_EQ(url2, iframe->document().url().string().utf8());
+ iframe = frame->firstChild()->nextSibling();
+ EXPECT_EQ(client.frame(), iframe);
+ EXPECT_TRUE(client.replacesCurrentHistoryItem());
+
+ FrameTestHelpers::loadFrame(frame,
+ "javascript:window.frames[1].location.assign('" + m_baseURL + "find.html')");
+ EXPECT_EQ(client.frame(), iframe);
EXPECT_FALSE(client.replacesCurrentHistoryItem());
}
« no previous file with comments | « Source/web/WebLocalFrameImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698