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

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: Change to CHECK. 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 63ae5f5c2859ac70bf5cc6024f223f959d4f8deb..b75fc5b8f52e73e0845f0e2ac3cf4724d9c4177e 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -1960,8 +1960,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");
@@ -1989,27 +1989,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
« no previous file with comments | « content/browser/web_contents/navigation_controller_impl_unittest.cc ('k') | content/public/browser/navigation_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698