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 3492196c00e5244c60c2b447af7a74f9e8abece7..519e4c916fd2f627914e52418d75dd7f849bdf94 100644 |
--- a/content/browser/frame_host/navigation_controller_impl_unittest.cc |
+++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc |
@@ -35,6 +35,7 @@ |
#include "content/public/test/mock_render_process_host.h" |
#include "content/public/test/test_notification_tracker.h" |
#include "content/public/test/test_utils.h" |
+#include "content/test/test_navigation_url_loader.h" |
clamy
2015/02/25 17:10:33
Remove this include which is now unnecessary.
carlosk
2015/02/25 19:30:21
Done.
|
#include "content/test/test_render_frame_host.h" |
#include "content/test/test_render_view_host.h" |
#include "content/test/test_web_contents.h" |
@@ -316,7 +317,8 @@ TEST_F(NavigationControllerTest, GoToOffset) { |
urls[i] = GURL(base::StringPrintf("http://www.a.com/%d", i)); |
} |
- main_test_rfh()->PrepareForCommit(urls[0]); |
+ main_test_rfh()->SendRendererInitiatedNavigationRequest(urls[0], true); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, urls[0]); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -326,7 +328,8 @@ TEST_F(NavigationControllerTest, GoToOffset) { |
EXPECT_FALSE(controller.CanGoToOffset(1)); |
for (int i = 1; i <= 4; ++i) { |
- main_test_rfh()->PrepareForCommit(urls[i]); |
+ main_test_rfh()->SendRendererInitiatedNavigationRequest(urls[i], true); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(i, urls[i]); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -362,7 +365,7 @@ TEST_F(NavigationControllerTest, GoToOffset) { |
url_index += offset; |
// Check that the GoToOffset will land on the expected page. |
EXPECT_EQ(urls[url_index], controller.GetPendingEntry()->GetVirtualURL()); |
- main_test_rfh()->PrepareForCommit(urls[url_index]); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(url_index, urls[url_index]); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -407,7 +410,7 @@ TEST_F(NavigationControllerTest, LoadURL) { |
// We should have gotten no notifications from the preceeding checks. |
EXPECT_EQ(0U, notifications.size()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -447,7 +450,7 @@ TEST_F(NavigationControllerTest, LoadURL) { |
// Simulate the beforeunload ack for the cross-site transition, and then the |
// commit. |
- main_test_rfh()->PrepareForCommit(url2); |
+ main_test_rfh()->PrepareForCommit(); |
contents()->GetPendingMainFrame()->SendNavigate(1, url2); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -489,7 +492,7 @@ TEST_F(NavigationControllerTest, LoadURLSameTime) { |
controller.LoadURL( |
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -500,7 +503,7 @@ TEST_F(NavigationControllerTest, LoadURLSameTime) { |
// Simulate the beforeunload ack for the cross-site transition, and then the |
// commit. |
- main_test_rfh()->PrepareForCommit(url2); |
+ main_test_rfh()->PrepareForCommit(); |
contents()->GetPendingMainFrame()->SendNavigate(1, url2); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -619,7 +622,7 @@ TEST_F(NavigationControllerTest, LoadURL_SamePage) { |
controller.LoadURL( |
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
EXPECT_EQ(0U, notifications.size()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -631,7 +634,7 @@ TEST_F(NavigationControllerTest, LoadURL_SamePage) { |
controller.LoadURL( |
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
EXPECT_EQ(0U, notifications.size()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -671,7 +674,7 @@ TEST_F(NavigationControllerTest, LoadURL_SamePage_DifferentMethod) { |
params.is_post = true; |
params.post_id = 123; |
params.page_state = PageState::CreateForTesting(url1, false, 0, 0); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigateWithParams(¶ms); |
// The post data should be visible. |
@@ -682,7 +685,7 @@ TEST_F(NavigationControllerTest, LoadURL_SamePage_DifferentMethod) { |
controller.LoadURL( |
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
// We should not have produced a new session history entry. |
@@ -773,7 +776,7 @@ TEST_F(NavigationControllerTest, LoadURL_NewPending) { |
const GURL kExistingURL1("http://eh"); |
controller.LoadURL( |
kExistingURL1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(kExistingURL1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, kExistingURL1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -785,9 +788,9 @@ TEST_F(NavigationControllerTest, LoadURL_NewPending) { |
EXPECT_EQ(0U, notifications.size()); |
// After the beforeunload but before it commits, do a new navigation. |
- main_test_rfh()->PrepareForCommit(kExistingURL2); |
+ main_test_rfh()->PrepareForCommit(); |
const GURL kNewURL("http://see"); |
- main_test_rfh()->PrepareForCommit(kNewURL); |
+ main_test_rfh()->PrepareForCommit(); |
contents()->GetMainFrame()->SendNavigate(3, kNewURL); |
// There should no longer be any pending entry, and the third navigation we |
@@ -811,7 +814,7 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) { |
const GURL kExistingURL1("http://foo/eh"); |
controller.LoadURL( |
kExistingURL1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(kExistingURL1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, kExistingURL1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -819,7 +822,7 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) { |
const GURL kExistingURL2("http://foo/bee"); |
controller.LoadURL( |
kExistingURL2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(kExistingURL2); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, kExistingURL2); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -833,7 +836,8 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) { |
// Before that commits, do a new navigation. |
const GURL kNewURL("http://foo/see"); |
- main_test_rfh()->PrepareForCommit(kNewURL); |
+ main_test_rfh()->SendRendererInitiatedNavigationRequest(kNewURL, true); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(3, kNewURL); |
// There should no longer be any pending entry, and the third navigation we |
@@ -859,7 +863,7 @@ TEST_F(NavigationControllerTest, LoadURL_PrivilegedPending) { |
kExistingURL1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
// Pretend it has bindings so we can tell if we incorrectly copy it. |
main_test_rfh()->GetRenderViewHost()->AllowBindings(2); |
- main_test_rfh()->PrepareForCommit(kExistingURL1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, kExistingURL1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -868,7 +872,7 @@ TEST_F(NavigationControllerTest, LoadURL_PrivilegedPending) { |
const GURL kExistingURL2("http://foo/eh"); |
controller.LoadURL( |
kExistingURL2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(kExistingURL2); |
+ main_test_rfh()->PrepareForCommit(); |
TestRenderFrameHost* foo_rfh = contents()->GetPendingMainFrame(); |
foo_rfh->SendNavigate(1, kExistingURL2); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
@@ -885,7 +889,8 @@ TEST_F(NavigationControllerTest, LoadURL_PrivilegedPending) { |
// Before that commits, do a new navigation. |
const GURL kNewURL("http://foo/bee"); |
- foo_rfh->PrepareForCommit(kNewURL); |
+ foo_rfh->SendRendererInitiatedNavigationRequest(kNewURL, true); |
+ foo_rfh->PrepareForCommit(); |
foo_rfh->SendNavigate(3, kNewURL); |
// There should no longer be any pending entry, and the third navigation we |
@@ -910,7 +915,7 @@ TEST_F(NavigationControllerTest, LoadURL_BackPreemptsPending) { |
const GURL kExistingURL1("http://foo/eh"); |
controller.LoadURL( |
kExistingURL1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(kExistingURL1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, kExistingURL1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -918,7 +923,7 @@ TEST_F(NavigationControllerTest, LoadURL_BackPreemptsPending) { |
const GURL kExistingURL2("http://foo/bee"); |
controller.LoadURL( |
kExistingURL2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(kExistingURL2); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, kExistingURL2); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -932,7 +937,8 @@ TEST_F(NavigationControllerTest, LoadURL_BackPreemptsPending) { |
EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); |
// Before that commits, a back navigation from the renderer commits. |
- main_test_rfh()->PrepareForCommit(kExistingURL1); |
+ main_test_rfh()->SendRendererInitiatedNavigationRequest(kExistingURL1, true); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, kExistingURL1); |
// There should no longer be any pending entry, and the back navigation we |
@@ -972,7 +978,8 @@ TEST_F(NavigationControllerTest, LoadURL_IgnorePreemptsPending) { |
// Before that commits, a document.write and location.reload can cause the |
// renderer to send a FrameNavigate with page_id -1. |
- main_test_rfh()->PrepareForCommit(kExistingURL); |
+ main_test_rfh()->SendRendererInitiatedNavigationRequest(kExistingURL, true); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(-1, kExistingURL); |
// This should clear the pending entry and notify of a navigation state |
@@ -1123,7 +1130,7 @@ TEST_F(NavigationControllerTest, LoadURL_WithBindings) { |
// Commit. |
TestRenderFrameHost* orig_rfh = contents()->GetMainFrame(); |
- orig_rfh->PrepareForCommit(url1); |
+ orig_rfh->PrepareForCommit(); |
orig_rfh->SendNavigate(0, url1); |
EXPECT_EQ(controller.GetEntryCount(), 1); |
EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); |
@@ -1140,7 +1147,7 @@ TEST_F(NavigationControllerTest, LoadURL_WithBindings) { |
// privileged url. |
controller.LoadURL( |
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- orig_rfh->PrepareForCommit(url2); |
+ orig_rfh->PrepareForCommit(); |
TestRenderFrameHost* new_rfh = contents()->GetPendingMainFrame(); |
new_rfh->GetRenderViewHost()->AllowBindings(1); |
new_rfh->SendNavigate(1, url2); |
@@ -1153,7 +1160,7 @@ TEST_F(NavigationControllerTest, LoadURL_WithBindings) { |
// Going back, the first entry should still appear unprivileged. |
controller.GoBack(); |
- new_rfh->PrepareForCommit(url1); |
+ new_rfh->PrepareForCommit(); |
orig_rfh->SendNavigate(0, url1); |
EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); |
EXPECT_EQ(0, controller.GetLastCommittedEntry()->bindings()); |
@@ -1169,7 +1176,7 @@ TEST_F(NavigationControllerTest, Reload) { |
controller.LoadURL( |
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
EXPECT_EQ(0U, notifications.size()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -1194,7 +1201,7 @@ TEST_F(NavigationControllerTest, Reload) { |
// See http://crbug.com/96041. |
EXPECT_TRUE(controller.GetVisibleEntry()->GetTitle().empty()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -1224,7 +1231,7 @@ TEST_F(NavigationControllerTest, Reload_GeneratesNewPage) { |
controller.LoadURL( |
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -1232,7 +1239,7 @@ TEST_F(NavigationControllerTest, Reload_GeneratesNewPage) { |
controller.Reload(true); |
EXPECT_EQ(0U, notifications.size()); |
- main_test_rfh()->PrepareForCommit(url2); |
+ main_test_rfh()->PrepareForCommitWithServerRedirect(url2); |
main_test_rfh()->SendNavigate(1, url2); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -1290,7 +1297,7 @@ TEST_F(NavigationControllerTest, ReloadOriginalRequestURL) { |
controller.LoadURL( |
original_url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
EXPECT_EQ(0U, notifications.size()); |
- main_test_rfh()->PrepareForCommit(final_url); |
+ main_test_rfh()->PrepareForCommitWithServerRedirect(final_url); |
main_test_rfh()->SendNavigateWithOriginalRequestURL( |
0, final_url, original_url); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
@@ -1323,7 +1330,7 @@ TEST_F(NavigationControllerTest, ReloadOriginalRequestURL) { |
EXPECT_TRUE(controller.GetVisibleEntry()->GetTitle().empty()); |
// Send that the navigation has proceeded; say it got redirected again. |
- main_test_rfh()->PrepareForCommit(final_url); |
+ main_test_rfh()->PrepareForCommitWithServerRedirect(final_url); |
main_test_rfh()->SendNavigate(0, final_url); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -1487,14 +1494,14 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) { |
controller.LoadURL( |
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
controller.LoadURL( |
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url2); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, url2); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -1511,7 +1518,7 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) { |
EXPECT_FALSE(controller.CanGoBack()); |
EXPECT_TRUE(controller.CanGoForward()); |
- main_test_rfh()->PrepareForCommit(url3); |
+ main_test_rfh()->PrepareForCommitWithServerRedirect(url3); |
main_test_rfh()->SendNavigate(2, url3); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -1569,15 +1576,19 @@ TEST_F(NavigationControllerTest, Back_OtherBackPending) { |
const GURL kUrl3("http://foo/3"); |
// First navigate three places so we have some back history. |
- main_test_rfh()->PrepareForCommit(kUrl1); |
+ main_test_rfh()->SendRendererInitiatedNavigationRequest(kUrl1, true); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, kUrl1); |
- main_test_rfh()->PrepareForCommit(kUrl2); |
+ main_test_rfh()->SendRendererInitiatedNavigationRequest(kUrl2, true); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, kUrl2); |
- main_test_rfh()->PrepareForCommit(kUrl3); |
+ main_test_rfh()->SendRendererInitiatedNavigationRequest(kUrl3, true); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(2, kUrl3); |
// With nothing pending, say we get a navigation to the second entry. |
- main_test_rfh()->PrepareForCommit(kUrl2); |
+ main_test_rfh()->SendRendererInitiatedNavigationRequest(kUrl2, true); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, kUrl2); |
// We know all the entries have the same site instance, so we can just grab |
@@ -1593,7 +1604,7 @@ TEST_F(NavigationControllerTest, Back_OtherBackPending) { |
// Now go forward to the last item again and say it was committed. |
controller.GoForward(); |
- main_test_rfh()->PrepareForCommit(kUrl3); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(2, kUrl3); |
// Now start going back one to the second page. It will be pending. |
@@ -1601,9 +1612,10 @@ TEST_F(NavigationControllerTest, Back_OtherBackPending) { |
EXPECT_EQ(1, controller.GetPendingEntryIndex()); |
EXPECT_EQ(2, controller.GetLastCommittedEntryIndex()); |
- // Not synthesize a totally new back event to the first page. This will not |
+ // Now synthesize a totally new back event to the first page. This will not |
// match the pending one. |
- main_test_rfh()->PrepareForCommit(kUrl1); |
+ main_test_rfh()->SendRendererInitiatedNavigationRequest(kUrl1, true); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, kUrl1); |
// The committed navigation should clear the pending entry. |
@@ -1623,18 +1635,18 @@ TEST_F(NavigationControllerTest, Forward) { |
const GURL url1("http://foo1"); |
const GURL url2("http://foo2"); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
- main_test_rfh()->PrepareForCommit(url2); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, url2); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
controller.GoBack(); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -1659,7 +1671,7 @@ TEST_F(NavigationControllerTest, Forward) { |
EXPECT_GE(controller.GetEntryAtIndex(0)->GetTimestamp(), |
controller.GetEntryAtIndex(1)->GetTimestamp()); |
- main_test_rfh()->PrepareForCommit(url2); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, url2); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -1692,17 +1704,17 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) { |
const GURL url2("http://foo2"); |
const GURL url3("http://foo3"); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
- main_test_rfh()->PrepareForCommit(url2); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, url2); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
controller.GoBack(); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -1719,7 +1731,7 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) { |
EXPECT_TRUE(controller.CanGoBack()); |
EXPECT_FALSE(controller.CanGoForward()); |
- main_test_rfh()->PrepareForCommit(url3); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(2, url3); |
EXPECT_EQ(1U, navigation_entry_committed_counter_); |
navigation_entry_committed_counter_ = 0; |
@@ -2384,7 +2396,7 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { |
GURL url(base::StringPrintf("http://www.a.com/%d", url_index)); |
controller.LoadURL( |
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(url_index, url); |
} |
@@ -2397,7 +2409,7 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { |
GURL url(base::StringPrintf("http://www.a.com/%d", url_index)); |
controller.LoadURL( |
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(url_index, url); |
url_index++; |
@@ -2416,7 +2428,7 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { |
url = GURL(base::StringPrintf("http:////www.a.com/%d", url_index)); |
controller.LoadURL( |
url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(url_index, url); |
url_index++; |
} |
@@ -2581,18 +2593,18 @@ TEST_F(NavigationControllerTest, Interstitial) { |
const GURL url1("http://foo"); |
controller.LoadURL( |
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
// Now navigate somewhere with an interstitial. |
const GURL url2("http://bar"); |
- controller.LoadURL( |
- url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
+ controller.LoadURL(url2, Referrer(), ui::PAGE_TRANSITION_TYPED, |
clamy
2015/02/25 17:10:33
After further thinking I think we should avoid doi
carlosk
2015/02/25 19:30:21
That doesn't seem to be the case. I read the descr
carlosk
2015/02/26 13:02:22
I forgot to add the link about interstitial pages
|
+ std::string()); |
controller.GetPendingEntry()->set_page_type(PAGE_TYPE_INTERSTITIAL); |
// At this point the interstitial will be displayed and the load will still |
// be pending. If the user continues, the load will commit. |
- main_test_rfh()->PrepareForCommit(url2); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, url2); |
// The page should be a normal page again. |
@@ -2613,23 +2625,23 @@ TEST_F(NavigationControllerTest, RemoveEntry) { |
controller.LoadURL( |
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
controller.LoadURL( |
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url2); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, url2); |
controller.LoadURL( |
url3, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url3); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(2, url3); |
controller.LoadURL( |
url4, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url4); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(3, url4); |
controller.LoadURL( |
url5, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url5); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(4, url5); |
// Try to remove the last entry. Will fail because it is the current entry. |
@@ -2644,7 +2656,7 @@ TEST_F(NavigationControllerTest, RemoveEntry) { |
EXPECT_FALSE(controller.RemoveEntryAtIndex(controller.GetEntryCount() - 2)); |
// Now commit and delete the last entry. |
- main_test_rfh()->PrepareForCommit(url4); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(3, url4); |
EXPECT_TRUE(controller.RemoveEntryAtIndex(controller.GetEntryCount() - 1)); |
EXPECT_EQ(4, controller.GetEntryCount()); |
@@ -2675,15 +2687,15 @@ TEST_F(NavigationControllerTest, RemoveEntryWithPending) { |
controller.LoadURL( |
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url1); |
controller.LoadURL( |
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url2); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, url2); |
controller.LoadURL( |
url3, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url3); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(2, url3); |
// Go back, but don't commit yet. Check that we can't delete the current |
@@ -2702,7 +2714,7 @@ TEST_F(NavigationControllerTest, RemoveEntryWithPending) { |
EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); |
// Now commit and ensure we land on the right entry. |
- main_test_rfh()->PrepareForCommit(url2); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, url2); |
EXPECT_EQ(2, controller.GetEntryCount()); |
EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); |
@@ -2725,11 +2737,11 @@ TEST_F(NavigationControllerTest, TransientEntry) { |
controller.LoadURL( |
url0, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url0); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url0); |
controller.LoadURL( |
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, url1); |
notifications.Reset(); |
@@ -2756,7 +2768,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { |
// Navigate. |
controller.LoadURL( |
url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url2); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(2, url2); |
// We should have navigated, transient entry should be gone. |
@@ -2768,7 +2780,8 @@ TEST_F(NavigationControllerTest, TransientEntry) { |
transient_entry->SetURL(transient_url); |
controller.SetTransientEntry(transient_entry); |
EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); |
- main_test_rfh()->PrepareForCommit(url3); |
+ main_test_rfh()->SendRendererInitiatedNavigationRequest(url3, true); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(3, url3); |
// Transient entry should be gone. |
EXPECT_EQ(url3, controller.GetVisibleEntry()->GetURL()); |
@@ -2781,7 +2794,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { |
transient_entry->SetURL(transient_url); |
controller.SetTransientEntry(transient_entry); |
EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); |
- main_test_rfh()->PrepareForCommit(url4); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(4, url4); |
EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL()); |
EXPECT_EQ(controller.GetEntryCount(), 5); |
@@ -2797,7 +2810,9 @@ TEST_F(NavigationControllerTest, TransientEntry) { |
// Transient entry should be gone. |
EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL()); |
EXPECT_EQ(controller.GetEntryCount(), 5); |
- main_test_rfh()->PrepareForCommit(url3); |
+ |
+ main_test_rfh()->SendRendererInitiatedNavigationRequest(url3, false); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(3, url3); |
// Add a transient and go to an entry before the current one. |
@@ -2811,7 +2826,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { |
EXPECT_EQ(url1, controller.GetPendingEntry()->GetURL()); |
// Visible entry does not update for history navigations until commit. |
EXPECT_EQ(url3, controller.GetVisibleEntry()->GetURL()); |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, url1); |
EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL()); |
@@ -2826,7 +2841,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { |
// land on url2 (which is visible after the commit). |
EXPECT_EQ(url2, controller.GetPendingEntry()->GetURL()); |
EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL()); |
- main_test_rfh()->PrepareForCommit(url2); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(2, url2); |
EXPECT_EQ(url2, controller.GetVisibleEntry()->GetURL()); |
@@ -2841,7 +2856,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { |
EXPECT_FALSE(controller.GetTransientEntry()); |
EXPECT_EQ(url3, controller.GetPendingEntry()->GetURL()); |
EXPECT_EQ(url2, controller.GetVisibleEntry()->GetURL()); |
- main_test_rfh()->PrepareForCommit(url3); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(3, url3); |
EXPECT_EQ(url3, controller.GetVisibleEntry()->GetURL()); |
@@ -2850,7 +2865,9 @@ TEST_F(NavigationControllerTest, TransientEntry) { |
transient_entry->SetURL(transient_url); |
controller.SetTransientEntry(transient_entry); |
EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); |
- main_test_rfh()->PrepareForCommit(url3_ref); |
+ |
+ main_test_rfh()->SendRendererInitiatedNavigationRequest(url3_ref, false); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(3, url3_ref); |
// Transient entry should be gone. |
EXPECT_FALSE(controller.GetTransientEntry()); |
@@ -2875,7 +2892,7 @@ TEST_F(NavigationControllerTest, ReloadTransient) { |
// Load |url0|, and start a pending navigation to |url1|. |
controller.LoadURL( |
url0, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
- main_test_rfh()->PrepareForCommit(url0); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url0); |
controller.LoadURL( |
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
@@ -2898,7 +2915,7 @@ TEST_F(NavigationControllerTest, ReloadTransient) { |
EXPECT_EQ(controller.GetEntryAtIndex(0)->GetURL(), url0); |
// Load of |transient_url| completes. |
- main_test_rfh()->PrepareForCommit(transient_url); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, transient_url); |
ASSERT_EQ(controller.GetEntryCount(), 2); |
EXPECT_EQ(controller.GetEntryAtIndex(0)->GetURL(), url0); |
@@ -2977,7 +2994,7 @@ TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) { |
url0, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
EXPECT_EQ(url0, controller.GetPendingEntry()->GetURL()); |
EXPECT_EQ(url0, controller.GetVisibleEntry()->GetURL()); |
- main_test_rfh()->PrepareForCommit(url0); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(0, url0); |
// For link clicks (renderer-initiated navigations), the pending entry should |
@@ -2991,7 +3008,7 @@ TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) { |
// After commit, both visible should be updated, there should be no pending |
// entry, and we should no longer treat the entry as renderer-initiated. |
- main_test_rfh()->PrepareForCommit(url1); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(1, url1); |
EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL()); |
EXPECT_FALSE(controller.GetPendingEntry()); |
@@ -4125,7 +4142,7 @@ TEST_F(NavigationControllerTest, PruneAllButLastCommittedForPendingNotInList) { |
EXPECT_EQ(1, controller.GetEntryCount()); |
// Try to commit the pending entry. |
- main_test_rfh()->PrepareForCommit(url3); |
+ main_test_rfh()->PrepareForCommit(); |
main_test_rfh()->SendNavigate(2, url3); |
EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
EXPECT_FALSE(controller.GetPendingEntry()); |
@@ -4414,7 +4431,7 @@ TEST_F(NavigationControllerTest, ClearHistoryList) { |
// Assume that the RF correctly cleared its history and commit the navigation. |
if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kEnableBrowserSideNavigation)) { |
- contents()->GetMainFrame()->PrepareForCommit(entry->GetURL()); |
+ contents()->GetMainFrame()->PrepareForCommit(); |
} |
contents()->GetPendingMainFrame()-> |
set_simulate_history_list_was_cleared(true); |