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

Unified Diff: chrome/browser/session_history_uitest.cc

Issue 1090002: Send session history offset and length parameters in the Navigate message to... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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
Index: chrome/browser/session_history_uitest.cc
===================================================================
--- chrome/browser/session_history_uitest.cc (revision 41858)
+++ chrome/browser/session_history_uitest.cc (working copy)
@@ -23,6 +23,7 @@
class SessionHistoryTest : public UITest {
protected:
SessionHistoryTest() : UITest() {
+ dom_automation_enabled_ = true;
}
virtual void SetUp() {
@@ -515,4 +516,40 @@
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

Powered by Google App Engine
This is Rietveld 408576698