diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-11 04:49:42 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-11 04:49:42 +0000 |
commit | 20452671d2890ad7464dea6086458b0b0ede81a3 (patch) | |
tree | 794b99b3eb6fa0b04864d774399d6d0afa3b7c2d /chrome/browser/tab_contents/web_contents_unittest.cc | |
parent | 780035a796dbbf2f78aa01ae709cab74a30f1c1c (diff) | |
download | chromium_src-20452671d2890ad7464dea6086458b0b0ede81a3.zip chromium_src-20452671d2890ad7464dea6086458b0b0ede81a3.tar.gz chromium_src-20452671d2890ad7464dea6086458b0b0ede81a3.tar.bz2 |
Fix crash on interstitial page when the renderer crashed.
Simply add a NULL check to make sure the view is still there before showing it.
Also fix a debug crash since the ResourceDispatcherHost assumes that it should always find the pid & route_id key, which is not true if the renderer crashed.
BUG=http://crbug.com/13795
TEST=See bug for repro instructions.
Review URL: http://codereview.chromium.org/122025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18150 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents/web_contents_unittest.cc')
-rw-r--r-- | chrome/browser/tab_contents/web_contents_unittest.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc index 97e09a5..5db8bb8 100644 --- a/chrome/browser/tab_contents/web_contents_unittest.cc +++ b/chrome/browser/tab_contents/web_contents_unittest.cc @@ -934,6 +934,41 @@ TEST_F(TabContentsTest, ShowInterstitialThenGoBack) { EXPECT_EQ(url1.spec(), entry->url().spec()); } +// Test navigating to a page that shows an interstitial, has a renderer crash, +// and then goes back. +TEST_F(TabContentsTest, ShowInterstitialCrashRendererThenGoBack) { + // Navigate to a page so we have a navigation entry in the controller. + GURL url1("http://www.google.com"); + rvh()->SendNavigate(1, url1); + EXPECT_EQ(1, controller().entry_count()); + + // Show interstitial. + TestInterstitialPage::InterstitialState state = + TestInterstitialPage::UNDECIDED; + bool deleted = false; + GURL interstitial_url("http://interstitial"); + TestInterstitialPage* interstitial = + new TestInterstitialPage(contents(), true, interstitial_url, + &state, &deleted); + TestInterstitialPageStateGuard state_guard(interstitial); + interstitial->Show(); + interstitial->TestDidNavigate(2, interstitial_url); + + // Crash the renderer + rvh()->TestOnMessageReceived(ViewHostMsg_RenderViewGone(0)); + + // While the interstitial is showing, go back. + controller().GoBack(); + rvh()->SendNavigate(1, url1); + + // Make sure we are back to the original page and that the interstitial is + // gone. + EXPECT_TRUE(deleted); + EXPECT_EQ(TestInterstitialPage::CANCELED, state); + NavigationEntry* entry = controller().GetActiveEntry(); + ASSERT_TRUE(entry); + EXPECT_EQ(url1.spec(), entry->url().spec()); +} // Test navigating to a page that shows an interstitial, then close the tab. TEST_F(TabContentsTest, ShowInterstitialThenCloseTab) { // Show interstitial. |