Index: content/renderer/render_view_browsertest.cc |
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc |
index 164feeccf11557bac65a2de22caff9459b0e1362..1c98a53eef6a39d40726ff42345bfcf828d10472 100644 |
--- a/content/renderer/render_view_browsertest.cc |
+++ b/content/renderer/render_view_browsertest.cc |
@@ -670,6 +670,7 @@ TEST_F(RenderViewImplTest, ReloadWhileSwappedOut) { |
request_params_A.current_history_list_offset = 1; |
request_params_A.pending_history_list_offset = 0; |
request_params_A.page_id = 1; |
+ request_params_A.nav_entry_id = 1; |
request_params_A.page_state = state_A; |
frame()->OnNavigate(common_params_A, StartNavigationParams(), |
request_params_A); |
@@ -701,6 +702,7 @@ TEST_F(RenderViewImplTest, ReloadWhileSwappedOut) { |
request_params.current_history_list_offset = 0; |
request_params.pending_history_list_offset = 0; |
request_params.page_id = 1; |
+ request_params.nav_entry_id = 1; |
request_params.page_state = state_A; |
frame()->OnNavigate(common_params, StartNavigationParams(), request_params); |
ProcessPendingMessages(); |
@@ -873,12 +875,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_); |
@@ -894,7 +896,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; |
RequestNavigationParams request_params_A; |
common_params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
@@ -903,16 +905,22 @@ TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { |
request_params_A.current_history_list_offset = 1; |
request_params_A.pending_history_list_offset = 0; |
request_params_A.page_id = 1; |
+ request_params_A.nav_entry_id = 1; |
request_params_A.page_state = state_A; |
frame()->OnNavigate(common_params_A, StartNavigationParams(), |
request_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; |
@@ -923,6 +931,7 @@ TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { |
request_params_B.current_history_list_offset = 0; |
request_params_B.pending_history_list_offset = 1; |
request_params_B.page_id = 2; |
+ request_params_B.nav_entry_id = 2; |
request_params_B.page_state = |
state_A; // Doesn't matter, just has to be present. |
frame()->OnNavigate(common_params_B, StartNavigationParams(), |
@@ -932,6 +941,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(); |