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

Unified Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 15041004: Replace PruneAllButActive with PruneAllButVisible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 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
Index: content/browser/web_contents/web_contents_impl_unittest.cc
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc
index 1c535acd1cb74155e5fe5b3a2ca5e80fe54f96b8..f6297a44dd9330fe484f2f86186c978402fa8b1d 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -1949,7 +1949,7 @@ TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) {
NavigationEntryImpl::FromNavigationEntry(
other_controller.GetEntryAtIndex(0))->site_instance(), 1,
other_controller.GetEntryAtIndex(0)->GetPageID());
- other_controller.CopyStateFromAndPrune(&controller());
+ EXPECT_TRUE(other_controller.CopyStateFromAndPrune(&controller()));
// The merged controller should only have two entries: url1 and url2.
ASSERT_EQ(2, other_controller.GetEntryCount());
@@ -1961,8 +1961,8 @@ TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) {
EXPECT_FALSE(other_contents->ShowingInterstitialPage());
}
-// Makes sure that CopyStateFromAndPrune does the right thing if the object
-// CopyStateFromAndPrune is invoked on is showing an interstitial.
+// Makes sure that CopyStateFromAndPrune cannot be called if the target is
+// showing an interstitial.
TEST_F(WebContentsImplTest, CopyStateFromAndPruneTargetInterstitial) {
// Navigate to a page.
GURL url1("http://www.google.com");
@@ -1990,27 +1990,10 @@ TEST_F(WebContentsImplTest, CopyStateFromAndPruneTargetInterstitial) {
interstitial->TestDidNavigate(1, url3);
EXPECT_TRUE(interstitial->is_showing());
EXPECT_EQ(2, other_controller.GetEntryCount());
- other_contents->ExpectSetHistoryLengthAndPrune(
- NavigationEntryImpl::FromNavigationEntry(
- other_controller.GetEntryAtIndex(0))->site_instance(), 1,
- other_controller.GetEntryAtIndex(0)->GetPageID());
- other_controller.CopyStateFromAndPrune(&controller());
-
- // The merged controller should only have two entries: url1 and url2.
- ASSERT_EQ(2, other_controller.GetEntryCount());
- EXPECT_EQ(1, other_controller.GetCurrentEntryIndex());
- EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL());
- EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->GetURL());
-
- // It should have a transient entry.
- EXPECT_TRUE(other_controller.GetTransientEntry());
-
- // And the interstitial should be showing.
- EXPECT_TRUE(other_contents->ShowingInterstitialPage());
- // And the interstitial should do a reload on don't proceed.
- EXPECT_TRUE(static_cast<InterstitialPageImpl*>(
- other_contents->GetInterstitialPage())->reload_on_dont_proceed());
+ // Ensure that we do not allow calling CopyStateFromAndPrune when an
+ // interstitial is showing in the target.
+ EXPECT_FALSE(other_controller.CanPruneAllButVisible());
}
// Regression test for http://crbug.com/168611 - the URLs passed by the

Powered by Google App Engine
This is Rietveld 408576698