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

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

Issue 2309583002: Fix for the NavigationControllerTest.BackSubframe test failures with PlzNavigate (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | 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 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(&params);
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(&params);
EXPECT_EQ(1U, navigation_entry_committed_counter_);
navigation_entry_committed_counter_ = 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698