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

Unified Diff: content/browser/frame_host/navigation_controller_impl_unittest.cc

Issue 308143004: Immediately SetTitle on a new NavigationEntry created via history.pushState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test problem in debug 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 | « content/browser/frame_host/navigation_controller_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigation_controller_impl_unittest.cc
diff --git a/content/browser/frame_host/navigation_controller_impl_unittest.cc b/content/browser/frame_host/navigation_controller_impl_unittest.cc
index 6afa917a14b3f08a3a644b0937f813b1e28a6944..464acb16ffef554c6729c23102411d0afe65406b 100644
--- a/content/browser/frame_host/navigation_controller_impl_unittest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc
@@ -4175,6 +4175,30 @@ TEST_F(NavigationControllerTest, MAYBE_PurgeScreenshot) {
}
}
+TEST_F(NavigationControllerTest, PushStateUpdatesTitle) {
+
+ // Navigate
+ test_rvh()->SendNavigate(1, GURL("http://foo"));
+
+ // Set title
+ base::string16 title(base::ASCIIToUTF16("Title"));
+ controller().GetLastCommittedEntry()->SetTitle(title);
+
+ // history.pushState() is called.
+ FrameHostMsg_DidCommitProvisionalLoad_Params params;
+ GURL url("http://foo#foo");
+ params.page_id = 2;
+ params.url = url;
+ params.page_state = PageState::CreateFromURL(url);
+ params.was_within_same_page = true;
+ test_rvh()->SendNavigateWithParams(&params);
+
+ // The title should immediately be visible on the new NavigationEntry.
+ base::string16 new_title =
+ controller().GetLastCommittedEntry()->GetTitleForDisplay(std::string());
+ EXPECT_EQ(title, new_title);
+}
+
// Test that the navigation controller clears its session history when a
// navigation commits with the clear history list flag set.
TEST_F(NavigationControllerTest, ClearHistoryList) {
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698