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() |