Index: content/renderer/render_view_browsertest.cc |
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc |
index 713c9767eb504864ad86320215278d86685fe238..cb197451013f50d673b48882a6cbdd483feb7a8b 100644 |
--- a/content/renderer/render_view_browsertest.cc |
+++ b/content/renderer/render_view_browsertest.cc |
@@ -614,6 +614,7 @@ TEST_F(RenderViewImplTest, ReloadWhileSwappedOut) { |
history_params_A.current_history_list_offset = 1; |
history_params_A.pending_history_list_offset = 0; |
history_params_A.page_id = 1; |
+ history_params_A.nav_entry_id = 1; |
history_params_A.page_state = state_A; |
frame()->OnNavigate(common_params_A, StartNavigationParams(), |
CommitNavigationParams(), history_params_A); |
@@ -645,6 +646,7 @@ TEST_F(RenderViewImplTest, ReloadWhileSwappedOut) { |
history_params.current_history_list_offset = 0; |
history_params.pending_history_list_offset = 0; |
history_params.page_id = 1; |
+ history_params.nav_entry_id = 1; |
history_params.page_state = state_A; |
frame()->OnNavigate(common_params, StartNavigationParams(), |
CommitNavigationParams(), history_params); |
@@ -819,12 +821,12 @@ TEST_F(RenderViewImplTest, DISABLED_LastCommittedUpdateState) { |
// ignored. See http://crbug.com/86758. |
TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { |
// Load page A. |
- LoadHTML("<div>Page A</div>"); |
+ LoadHTML("<div id=pagename>Page A</div>"); |
EXPECT_EQ(1, view()->history_list_length_); |
EXPECT_EQ(0, view()->history_list_offset_); |
// Load page B, which will trigger an UpdateState message for page A. |
- LoadHTML("<div>Page B</div>"); |
+ LoadHTML("<div id=pagename>Page B</div>"); |
EXPECT_EQ(2, view()->history_list_length_); |
EXPECT_EQ(1, view()->history_list_offset_); |
@@ -840,7 +842,7 @@ TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { |
EXPECT_EQ(1, page_id_A); |
render_thread_->sink().ClearMessages(); |
- // Back to page A (page_id 1) and commit. |
+ // Back to page A (nav_entry_id 1) and commit. |
CommonNavigationParams common_params_A; |
HistoryNavigationParams history_params_A; |
common_params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
@@ -849,16 +851,23 @@ TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { |
history_params_A.current_history_list_offset = 1; |
history_params_A.pending_history_list_offset = 0; |
history_params_A.page_id = 1; |
+ history_params_A.nav_entry_id = 1; |
history_params_A.page_state = state_A; |
frame()->OnNavigate(common_params_A, StartNavigationParams(), |
CommitNavigationParams(), history_params_A); |
ProcessPendingMessages(); |
// A new navigation commits, clearing the forward history. |
- LoadHTML("<div>Page C</div>"); |
+ LoadHTML("<div id=pagename>Page C</div>"); |
EXPECT_EQ(2, view()->history_list_length_); |
EXPECT_EQ(1, view()->history_list_offset_); |
EXPECT_EQ(3, view()->page_id_); // page C is now page id 3 |
+ int was_page_c = -1; |
+ base::string16 check_page_c = |
+ base::ASCIIToUTF16( |
+ "Number(document.getElementById('pagename').innerHTML == 'Page C')"); |
+ EXPECT_TRUE(ExecuteJavaScriptAndReturnIntValue(check_page_c, &was_page_c)); |
+ EXPECT_EQ(1, was_page_c); |
// The browser then sends a stale navigation to B, which should be ignored. |
CommonNavigationParams common_params_B; |
@@ -869,6 +878,7 @@ TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { |
history_params_B.current_history_list_offset = 0; |
history_params_B.pending_history_list_offset = 1; |
history_params_B.page_id = 2; |
+ history_params_B.nav_entry_id = 2; |
history_params_B.page_state = |
state_A; // Doesn't matter, just has to be present. |
frame()->OnNavigate(common_params_B, StartNavigationParams(), |
@@ -878,6 +888,9 @@ TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { |
EXPECT_EQ(2, view()->history_list_length_); |
EXPECT_EQ(1, view()->history_list_offset_); |
EXPECT_EQ(3, view()->page_id_); // page C, not page B |
+ was_page_c = -1; |
+ EXPECT_TRUE(ExecuteJavaScriptAndReturnIntValue(check_page_c, &was_page_c)); |
+ EXPECT_EQ(1, was_page_c); |
// Check for a valid DidDropNavigation message. |
ProcessPendingMessages(); |