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

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

Issue 263903006: Reland "Make same-document history navigations commit with the proper type." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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/loader/FrameLoaderTypes.h ('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 4d4473ef76772ec5ff154a112d44b6b8664c9adf..d8bbe2fea659d672766abe578b2f864123052ad6 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -5100,6 +5100,37 @@ TEST_F(WebFrameTest, PushStateStartsAndStops)
EXPECT_EQ(client.differentDocumentStartCount(), 1);
}
+class TestDidNavigateCommitTypeWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
+public:
+ TestDidNavigateCommitTypeWebFrameClient()
+ : m_lastCommitType(WebHistoryInertCommit)
+ {
+ }
+
+ virtual void didNavigateWithinPage(WebLocalFrame*, const WebHistoryItem&, WebHistoryCommitType type) OVERRIDE
+ {
+ m_lastCommitType = type;
+ }
+
+ WebHistoryCommitType lastCommitType() const { return m_lastCommitType; }
+
+private:
+ WebHistoryCommitType m_lastCommitType;
+};
+
+TEST_F(WebFrameTest, SameDocumentHistoryNavigationCommitType)
+{
+ registerMockedHttpURLLoad("push_state.html");
+ TestDidNavigateCommitTypeWebFrameClient client;
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "push_state.html", true, &client);
+ RefPtr<WebCore::HistoryItem> item = webViewImpl->page()->mainFrame()->loader().currentItem();
+ runPendingTasks();
+
+ webViewImpl->page()->mainFrame()->loader().loadHistoryItem(item.get(), WebCore::HistorySameDocumentLoad);
+ EXPECT_EQ(WebBackForwardCommit, client.lastCommitType());
+}
+
class TestHistoryWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
public:
TestHistoryWebFrameClient()
« no previous file with comments | « Source/core/loader/FrameLoaderTypes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698