Index: content/browser/tab_contents/navigation_controller_unittest.cc |
diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc |
index 64052f46e57ab45a58fa042ac24cd15aaf2238db..dc90da779a4cc3f151a4400111051ae9cc05b75a 100644 |
--- a/content/browser/tab_contents/navigation_controller_unittest.cc |
+++ b/content/browser/tab_contents/navigation_controller_unittest.cc |
@@ -153,7 +153,10 @@ TEST_F(NavigationControllerTest, LoadURL) { |
EXPECT_FALSE(controller().CanGoForward()); |
EXPECT_EQ(contents()->GetMaxPageID(), 0); |
- rvh()->SendNavigate(1, url2); |
+ // Simulate the beforeunload ack for the cross-site transition, and then the |
+ // commit. |
+ rvh()->SendShouldCloseACK(true); |
+ contents()->pending_rvh()->SendNavigate(1, url2); |
EXPECT_TRUE(notifications.Check1AndReset( |
NotificationType::NAV_ENTRY_COMMITTED)); |
@@ -277,9 +280,10 @@ TEST_F(NavigationControllerTest, LoadURL_NewPending) { |
PageTransition::TYPED); |
EXPECT_EQ(0U, notifications.size()); |
- // Before that commits, do a new navigation. |
+ // After the beforeunload but before it commits, do a new navigation. |
+ rvh()->SendShouldCloseACK(true); |
const GURL kNewURL("http://see"); |
- rvh()->SendNavigate(3, kNewURL); |
+ contents()->pending_rvh()->SendNavigate(3, kNewURL); |
// There should no longer be any pending entry, and the third navigation we |
// just made should be committed. |
@@ -298,14 +302,14 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) { |
RegisterForAllNavNotifications(¬ifications, &controller()); |
// First make some history. |
- const GURL kExistingURL1("http://eh"); |
+ const GURL kExistingURL1("http://foo/eh"); |
controller().LoadURL(kExistingURL1, GURL(), |
PageTransition::TYPED); |
rvh()->SendNavigate(0, kExistingURL1); |
EXPECT_TRUE(notifications.Check1AndReset( |
NotificationType::NAV_ENTRY_COMMITTED)); |
- const GURL kExistingURL2("http://bee"); |
+ const GURL kExistingURL2("http://foo/bee"); |
controller().LoadURL(kExistingURL2, GURL(), |
PageTransition::TYPED); |
rvh()->SendNavigate(1, kExistingURL2); |
@@ -320,7 +324,7 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) { |
EXPECT_EQ(1, controller().last_committed_entry_index()); |
// Before that commits, do a new navigation. |
- const GURL kNewURL("http://see"); |
+ const GURL kNewURL("http://foo/see"); |
content::LoadCommittedDetails details; |
rvh()->SendNavigate(3, kNewURL); |
@@ -341,20 +345,20 @@ TEST_F(NavigationControllerTest, LoadURL_BackPreemptsPending) { |
RegisterForAllNavNotifications(¬ifications, &controller()); |
// First make some history. |
- const GURL kExistingURL1("http://eh"); |
+ const GURL kExistingURL1("http://foo/eh"); |
controller().LoadURL(kExistingURL1, GURL(), PageTransition::TYPED); |
rvh()->SendNavigate(0, kExistingURL1); |
EXPECT_TRUE(notifications.Check1AndReset( |
NotificationType::NAV_ENTRY_COMMITTED)); |
- const GURL kExistingURL2("http://bee"); |
+ const GURL kExistingURL2("http://foo/bee"); |
controller().LoadURL(kExistingURL2, GURL(), PageTransition::TYPED); |
rvh()->SendNavigate(1, kExistingURL2); |
EXPECT_TRUE(notifications.Check1AndReset( |
NotificationType::NAV_ENTRY_COMMITTED)); |
// Now make a pending new navigation. |
- const GURL kNewURL("http://see"); |
+ const GURL kNewURL("http://foo/see"); |
controller().LoadURL(kNewURL, GURL(), PageTransition::TYPED); |
EXPECT_EQ(0U, notifications.size()); |
EXPECT_EQ(-1, controller().pending_entry_index()); |
@@ -524,9 +528,9 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) { |
TestNotificationTracker notifications; |
RegisterForAllNavNotifications(¬ifications, &controller()); |
- const GURL url1("http://foo1"); |
- const GURL url2("http://foo2"); |
- const GURL url3("http://foo3"); |
+ const GURL url1("http://foo/1"); |
+ const GURL url2("http://foo/2"); |
+ const GURL url3("http://foo/3"); |
controller().LoadURL(url1, GURL(), PageTransition::TYPED); |
rvh()->SendNavigate(0, url1); |
@@ -1417,13 +1421,13 @@ TEST_F(NavigationControllerTest, Interstitial) { |
} |
TEST_F(NavigationControllerTest, RemoveEntry) { |
- const GURL url1("http://foo1"); |
- const GURL url2("http://foo2"); |
- const GURL url3("http://foo3"); |
- const GURL url4("http://foo4"); |
- const GURL url5("http://foo5"); |
- const GURL pending_url("http://pending"); |
- const GURL default_url("http://default"); |
+ const GURL url1("http://foo/1"); |
+ const GURL url2("http://foo/2"); |
+ const GURL url3("http://foo/3"); |
+ const GURL url4("http://foo/4"); |
+ const GURL url5("http://foo/5"); |
+ const GURL pending_url("http://foo/pending"); |
+ const GURL default_url("http://foo/default"); |
controller().LoadURL(url1, GURL(), PageTransition::TYPED); |
rvh()->SendNavigate(0, url1); |
@@ -1480,12 +1484,12 @@ TEST_F(NavigationControllerTest, TransientEntry) { |
TestNotificationTracker notifications; |
RegisterForAllNavNotifications(¬ifications, &controller()); |
- const GURL url0("http://foo0"); |
- const GURL url1("http://foo1"); |
- const GURL url2("http://foo2"); |
- const GURL url3("http://foo3"); |
- const GURL url4("http://foo4"); |
- const GURL transient_url("http://transient"); |
+ const GURL url0("http://foo/0"); |
+ const GURL url1("http://foo/1"); |
+ const GURL url2("http://foo/2"); |
+ const GURL url3("http://foo/3"); |
+ const GURL url4("http://foo/4"); |
+ const GURL transient_url("http://foo/transient"); |
controller().LoadURL(url0, GURL(), PageTransition::TYPED); |
rvh()->SendNavigate(0, url0); |
@@ -1939,9 +1943,9 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune6) { |
// Tests that navigations initiated from the page (with the history object) |
// work as expected without navigation entries. |
TEST_F(NavigationControllerTest, HistoryNavigate) { |
- const GURL url1("http://foo1"); |
- const GURL url2("http://foo2"); |
- const GURL url3("http://foo3"); |
+ const GURL url1("http://foo/1"); |
+ const GURL url2("http://foo/2"); |
+ const GURL url3("http://foo/3"); |
NavigateAndCommit(url1); |
NavigateAndCommit(url2); |
@@ -1996,9 +2000,9 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForSingle) { |
// Test call to PruneAllButActive for last entry. |
TEST_F(NavigationControllerTest, PruneAllButActiveForLast) { |
- const GURL url1("http://foo1"); |
- const GURL url2("http://foo2"); |
- const GURL url3("http://foo3"); |
+ const GURL url1("http://foo/1"); |
+ const GURL url2("http://foo/2"); |
+ const GURL url3("http://foo/3"); |
NavigateAndCommit(url1); |
NavigateAndCommit(url2); |
@@ -2015,9 +2019,9 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForLast) { |
// Test call to PruneAllButActive for intermediate entry. |
TEST_F(NavigationControllerTest, PruneAllButActiveForIntermediate) { |
- const GURL url1("http://foo1"); |
- const GURL url2("http://foo2"); |
- const GURL url3("http://foo3"); |
+ const GURL url1("http://foo/1"); |
+ const GURL url2("http://foo/2"); |
+ const GURL url3("http://foo/3"); |
NavigateAndCommit(url1); |
NavigateAndCommit(url2); |
@@ -2033,9 +2037,9 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForIntermediate) { |
// Test call to PruneAllButActive for intermediate entry. |
TEST_F(NavigationControllerTest, PruneAllButActiveForPending) { |
- const GURL url1("http://foo1"); |
- const GURL url2("http://foo2"); |
- const GURL url3("http://foo3"); |
+ const GURL url1("http://foo/1"); |
+ const GURL url2("http://foo/2"); |
+ const GURL url3("http://foo/3"); |
NavigateAndCommit(url1); |
NavigateAndCommit(url2); |
@@ -2049,9 +2053,9 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForPending) { |
// Test call to PruneAllButActive for transient entry. |
TEST_F(NavigationControllerTest, PruneAllButActiveForTransient) { |
- const GURL url0("http://foo0"); |
- const GURL url1("http://foo1"); |
- const GURL transient_url("http://transient"); |
+ const GURL url0("http://foo/0"); |
+ const GURL url1("http://foo/1"); |
+ const GURL transient_url("http://foo/transient"); |
controller().LoadURL(url0, GURL(), PageTransition::TYPED); |
rvh()->SendNavigate(0, url0); |