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 b01157bf13be2272044ab388e6344253a3bf35f3..6acff34e861f9f4a53dae1cecaab7c7f8c740d06 100644 |
--- a/content/browser/frame_host/navigation_controller_impl_unittest.cc |
+++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc |
@@ -2563,7 +2563,13 @@ TEST_F(NavigationControllerTest, BackSubframe) { |
params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; |
params.page_state = PageState::CreateFromURL(url2); |
params.item_sequence_number = item_sequence_number2; |
- subframe->PrepareForCommit(); |
+ // If PlzNavigate is enabled, the TestRenderFrameHost::PrepareForCommit() |
+ // function expects the navigation request to be available in the |
+ // FrameTreeNode. This may not always be true. Please refer to the |
+ // NavigationControllerImpl::NavigateToPendingEntryInternal() function for |
+ // more information. The gist is we may run out of frames to navigate due to |
+ // lack of available history or we are unable to match a frame by name. |
+ subframe->PrepareForCommitIfNecessary(); |
clamy
2016/09/06 12:32:08
This test used to work with PlzNavigate enabled. W
ananta
2016/09/07 02:43:37
Thanks for the tip. It does fail because of the ch
|
subframe->SendNavigateWithParams(¶ms); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -2583,7 +2589,9 @@ TEST_F(NavigationControllerTest, BackSubframe) { |
params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; |
params.page_state = PageState::CreateFromURL(subframe_url); |
params.item_sequence_number = item_sequence_number1; |
- subframe->PrepareForCommit(); |
+ // Please refer to the comments for the test case above as to why we are |
+ // using PrepareForCommitIfNecessary() instead of PrepareForCommit(). |
+ subframe->PrepareForCommitIfNecessary(); |
subframe->SendNavigateWithParams(¶ms); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |