diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 16:39:44 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 16:39:44 +0000 |
commit | 1e6d82afa2241e27d0134a2fec2f9d230979bb01 (patch) | |
tree | ed9aac1cd7754531397aa4156bf315bf20ef0f04 /chrome/browser/tab_contents/web_contents_unittest.cc | |
parent | 661452b3f486a43f9b102f46aa6d0a097361718b (diff) | |
download | chromium_src-1e6d82afa2241e27d0134a2fec2f9d230979bb01.zip chromium_src-1e6d82afa2241e27d0134a2fec2f9d230979bb01.tar.gz chromium_src-1e6d82afa2241e27d0134a2fec2f9d230979bb01.tar.bz2 |
Fix interstitial crash.
The hidden page's renderer can crash before InterstitialPage::DidNavigate() gets called.
Add an if check for this case.
BUG=http://crbug.com/14942
TEST=see bug for info
Review URL: http://codereview.chromium.org/146070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19129 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 | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc index c391fd1..3b1c43e 100644 --- a/chrome/browser/tab_contents/web_contents_unittest.cc +++ b/chrome/browser/tab_contents/web_contents_unittest.cc @@ -938,7 +938,6 @@ TEST_F(TabContentsTest, ShowInterstitialThenGoBack) { // Test navigating to a page that shows an interstitial, has a renderer crash, // and then goes back. -// http://crbug.com/13937: Disabling because it's leaky on win/mac. TEST_F(TabContentsTest, ShowInterstitialCrashRendererThenGoBack) { // Navigate to a page so we have a navigation entry in the controller. GURL url1("http://www.google.com"); @@ -972,6 +971,32 @@ TEST_F(TabContentsTest, ShowInterstitialCrashRendererThenGoBack) { ASSERT_TRUE(entry); EXPECT_EQ(url1.spec(), entry->url().spec()); } + +// Test navigating to a page that shows an interstitial, has the renderer crash, +// and then navigates to the interstitial. +TEST_F(TabContentsTest, ShowInterstitialCrashRendererThenNavigate) { + // 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(); + + // Crash the renderer + rvh()->TestOnMessageReceived(ViewHostMsg_RenderViewGone(0)); + + interstitial->TestDidNavigate(2, interstitial_url); +} + // Test navigating to a page that shows an interstitial, then close the tab. TEST_F(TabContentsTest, ShowInterstitialThenCloseTab) { // Show interstitial. |