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

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 14221009: Rename RenderViewHostDelegate::RenderViewGone -> RenderViewTerminated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile fix Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "content/browser/renderer_host/render_view_host_impl.h" 7 #include "content/browser/renderer_host/render_view_host_impl.h"
8 #include "content/browser/renderer_host/test_render_view_host.h" 8 #include "content/browser/renderer_host/test_render_view_host.h"
9 #include "content/browser/site_instance_impl.h" 9 #include "content/browser/site_instance_impl.h"
10 #include "content/browser/web_contents/interstitial_page_impl.h" 10 #include "content/browser/web_contents/interstitial_page_impl.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if (enabled()) 149 if (enabled())
150 CommandReceived(); 150 CommandReceived();
151 } 151 }
152 152
153 void TestDidNavigate(int page_id, const GURL& url) { 153 void TestDidNavigate(int page_id, const GURL& url) {
154 ViewHostMsg_FrameNavigate_Params params; 154 ViewHostMsg_FrameNavigate_Params params;
155 InitNavigateParams(&params, page_id, url, PAGE_TRANSITION_TYPED); 155 InitNavigateParams(&params, page_id, url, PAGE_TRANSITION_TYPED);
156 DidNavigate(GetRenderViewHostForTesting(), params); 156 DidNavigate(GetRenderViewHostForTesting(), params);
157 } 157 }
158 158
159 void TestRenderViewGone(base::TerminationStatus status, int error_code) { 159 void TestRenderViewTerminated(base::TerminationStatus status,
160 RenderViewGone(GetRenderViewHostForTesting(), status, error_code); 160 int error_code) {
161 RenderViewTerminated(GetRenderViewHostForTesting(), status, error_code);
161 } 162 }
162 163
163 bool is_showing() const { 164 bool is_showing() const {
164 return static_cast<TestRenderWidgetHostView*>( 165 return static_cast<TestRenderWidgetHostView*>(
165 GetRenderViewHostForTesting()->GetView())->is_showing(); 166 GetRenderViewHostForTesting()->GetView())->is_showing();
166 } 167 }
167 168
168 void ClearStates() { 169 void ClearStates() {
169 state_ = NULL; 170 state_ = NULL;
170 deleted_ = NULL; 171 deleted_ = NULL;
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1799 // Show an interstitial. 1800 // Show an interstitial.
1800 TestInterstitialPage::InterstitialState state = 1801 TestInterstitialPage::InterstitialState state =
1801 TestInterstitialPage::INVALID; 1802 TestInterstitialPage::INVALID;
1802 bool deleted = false; 1803 bool deleted = false;
1803 GURL url("http://interstitial"); 1804 GURL url("http://interstitial");
1804 TestInterstitialPage* interstitial = 1805 TestInterstitialPage* interstitial =
1805 new TestInterstitialPage(contents(), true, url, &state, &deleted); 1806 new TestInterstitialPage(contents(), true, url, &state, &deleted);
1806 TestInterstitialPageStateGuard state_guard(interstitial); 1807 TestInterstitialPageStateGuard state_guard(interstitial);
1807 interstitial->Show(); 1808 interstitial->Show();
1808 // Simulate a renderer crash before the interstitial is shown. 1809 // Simulate a renderer crash before the interstitial is shown.
1809 interstitial->TestRenderViewGone( 1810 interstitial->TestRenderViewTerminated(
1810 base::TERMINATION_STATUS_PROCESS_CRASHED, -1); 1811 base::TERMINATION_STATUS_PROCESS_CRASHED, -1);
1811 // The interstitial should have been dismissed. 1812 // The interstitial should have been dismissed.
1812 EXPECT_EQ(TestInterstitialPage::CANCELED, state); 1813 EXPECT_EQ(TestInterstitialPage::CANCELED, state);
1813 RunAllPendingInMessageLoop(); 1814 RunAllPendingInMessageLoop();
1814 EXPECT_TRUE(deleted); 1815 EXPECT_TRUE(deleted);
1815 1816
1816 // Now try again but this time crash the intersitial after it was shown. 1817 // Now try again but this time crash the intersitial after it was shown.
1817 interstitial = 1818 interstitial =
1818 new TestInterstitialPage(contents(), true, url, &state, &deleted); 1819 new TestInterstitialPage(contents(), true, url, &state, &deleted);
1819 interstitial->Show(); 1820 interstitial->Show();
1820 interstitial->TestDidNavigate(1, url); 1821 interstitial->TestDidNavigate(1, url);
1821 // Simulate a renderer crash. 1822 // Simulate a renderer crash.
1822 interstitial->TestRenderViewGone( 1823 interstitial->TestRenderViewTerminated(
1823 base::TERMINATION_STATUS_PROCESS_CRASHED, -1); 1824 base::TERMINATION_STATUS_PROCESS_CRASHED, -1);
1824 // The interstitial should have been dismissed. 1825 // The interstitial should have been dismissed.
1825 EXPECT_EQ(TestInterstitialPage::CANCELED, state); 1826 EXPECT_EQ(TestInterstitialPage::CANCELED, state);
1826 RunAllPendingInMessageLoop(); 1827 RunAllPendingInMessageLoop();
1827 EXPECT_TRUE(deleted); 1828 EXPECT_TRUE(deleted);
1828 } 1829 }
1829 1830
1830 // Tests that showing an interstitial as a result of a browser initiated 1831 // Tests that showing an interstitial as a result of a browser initiated
1831 // navigation while an interstitial is showing does not remove the pending 1832 // navigation while an interstitial is showing does not remove the pending
1832 // entry (see http://crbug.com/9791). 1833 // entry (see http://crbug.com/9791).
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 TEST_F(WebContentsImplTest, PendingContents) { 2044 TEST_F(WebContentsImplTest, PendingContents) {
2044 scoped_ptr<TestWebContents> other_contents( 2045 scoped_ptr<TestWebContents> other_contents(
2045 static_cast<TestWebContents*>(CreateTestWebContents())); 2046 static_cast<TestWebContents*>(CreateTestWebContents()));
2046 contents()->AddPendingContents(other_contents.get()); 2047 contents()->AddPendingContents(other_contents.get());
2047 int route_id = other_contents->GetRenderViewHost()->GetRoutingID(); 2048 int route_id = other_contents->GetRenderViewHost()->GetRoutingID();
2048 other_contents.reset(); 2049 other_contents.reset();
2049 EXPECT_EQ(NULL, contents()->GetCreatedWindow(route_id)); 2050 EXPECT_EQ(NULL, contents()->GetCreatedWindow(route_id));
2050 } 2051 }
2051 2052
2052 } // namespace content 2053 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698