summaryrefslogtreecommitdiffstats
path: root/chrome/browser/session_history_uitest.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 23:03:00 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 23:03:00 +0000
commit3cc72b1caa55ca87811d8fab1ac9d55f05c2d496 (patch)
tree4379348afc5100d4188fb03650aa2f8013f5f254 /chrome/browser/session_history_uitest.cc
parent330a9d04c938c3e79c30faade3713a1378b9bdeb (diff)
downloadchromium_src-3cc72b1caa55ca87811d8fab1ac9d55f05c2d496.zip
chromium_src-3cc72b1caa55ca87811d8fab1ac9d55f05c2d496.tar.gz
chromium_src-3cc72b1caa55ca87811d8fab1ac9d55f05c2d496.tar.bz2
Send session history offset and length parameters in the Navigate message to
keep the renderer's notion of those values properly synchronized with the NavigationController. R=brettw BUG=18062 TEST=see session_history_uitest.cc Review URL: http://codereview.chromium.org/1090002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42022 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/session_history_uitest.cc')
-rw-r--r--chrome/browser/session_history_uitest.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/chrome/browser/session_history_uitest.cc b/chrome/browser/session_history_uitest.cc
index 8209338..e8ac1c5 100644
--- a/chrome/browser/session_history_uitest.cc
+++ b/chrome/browser/session_history_uitest.cc
@@ -23,6 +23,7 @@ const wchar_t kDocRoot[] = L"chrome/test/data";
class SessionHistoryTest : public UITest {
protected:
SessionHistoryTest() : UITest() {
+ dom_automation_enabled_ = true;
}
virtual void SetUp() {
@@ -515,4 +516,40 @@ TEST_F(SessionHistoryTest, LocationChangeInSubframe) {
EXPECT_EQ(L"Default Title", GetTabTitle());
}
+TEST_F(SessionHistoryTest, HistoryLength) {
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(kDocRoot, NULL);
+ ASSERT_TRUE(server.get());
+
+ int length;
+ ASSERT_TRUE(tab_->ExecuteAndExtractInt(
+ L"", L"domAutomationController.send(history.length)", &length));
+ EXPECT_EQ(1, length);
+
+ ASSERT_TRUE(tab_->NavigateToURL(server->TestServerPage("files/title1.html")));
+
+ ASSERT_TRUE(tab_->ExecuteAndExtractInt(
+ L"", L"domAutomationController.send(history.length)", &length));
+ EXPECT_EQ(2, length);
+
+ // Now test that history.length is updated when the navigation is committed.
+ ASSERT_TRUE(tab_->NavigateToURL(server->TestServerPage(
+ "files/session_history/record_length.html")));
+ ASSERT_TRUE(tab_->ExecuteAndExtractInt(
+ L"", L"domAutomationController.send(history.length)", &length));
+ EXPECT_EQ(3, length);
+ ASSERT_TRUE(tab_->ExecuteAndExtractInt(
+ L"", L"domAutomationController.send(history_length)", &length));
+ EXPECT_EQ(3, length);
+
+ ASSERT_TRUE(tab_->GoBack());
+ ASSERT_TRUE(tab_->GoBack());
+
+ // Ensure history.length is properly truncated.
+ ASSERT_TRUE(tab_->NavigateToURL(server->TestServerPage("files/title2.html")));
+ ASSERT_TRUE(tab_->ExecuteAndExtractInt(
+ L"", L"domAutomationController.send(history.length)", &length));
+ EXPECT_EQ(2, length);
+}
+
} // namespace