Commit 518f6b3b authored by nick's avatar nick Committed by Commit bot

Eliminate a use of GetMainFrame() from RVHTester by porting helper functionality to RFHTester.

BUG=304341
TEST=browser_tests
TBR=agl@chromium.org

Review URL: https://codereview.chromium.org/639033004

Cr-Commit-Position: refs/heads/master@{#299922}
parent 6874b75d
...@@ -560,9 +560,11 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, ...@@ -560,9 +560,11 @@ IN_PROC_BROWSER_TEST_F(SSLUITest,
// Wait until we hear the load failure, and make sure we haven't swapped out // Wait until we hear the load failure, and make sure we haven't swapped out
// the previous page. Prevents regression of http://crbug.com/82667. // the previous page. Prevents regression of http://crbug.com/82667.
// TODO(creis/nick): Move the swapped-out part of this test into content
// and remove IsRenderViewHostSwappedOut from the public API.
load_failed_observer.Wait(); load_failed_observer.Wait();
EXPECT_FALSE(content::RenderViewHostTester::IsRenderViewHostSwappedOut( EXPECT_FALSE(content::RenderFrameHostTester::IsRenderFrameHostSwappedOut(
tab->GetRenderViewHost())); tab->GetMainFrame()));
// We should be back at the original good page. // We should be back at the original good page.
EXPECT_FALSE(browser()->tab_strip_model()->GetActiveWebContents()-> EXPECT_FALSE(browser()->tab_strip_model()->GetActiveWebContents()->
......
...@@ -46,6 +46,11 @@ RenderFrameHost* RenderFrameHostTester::GetPendingForController( ...@@ -46,6 +46,11 @@ RenderFrameHost* RenderFrameHostTester::GetPendingForController(
return web_contents->GetRenderManagerForTesting()->pending_frame_host(); return web_contents->GetRenderManagerForTesting()->pending_frame_host();
} }
// static
bool RenderFrameHostTester::IsRenderFrameHostSwappedOut(RenderFrameHost* rfh) {
return static_cast<RenderFrameHostImpl*>(rfh)->is_swapped_out();
}
// RenderViewHostTester ------------------------------------------------------- // RenderViewHostTester -------------------------------------------------------
// static // static
...@@ -53,12 +58,6 @@ RenderViewHostTester* RenderViewHostTester::For(RenderViewHost* host) { ...@@ -53,12 +58,6 @@ RenderViewHostTester* RenderViewHostTester::For(RenderViewHost* host) {
return static_cast<TestRenderViewHost*>(host); return static_cast<TestRenderViewHost*>(host);
} }
// static
bool RenderViewHostTester::IsRenderViewHostSwappedOut(RenderViewHost* rvh) {
return static_cast<RenderFrameHostImpl*>(rvh->GetMainFrame())->rfh_state() ==
RenderFrameHostImpl::STATE_SWAPPED_OUT;
}
// static // static
bool RenderViewHostTester::TestOnMessageReceived(RenderViewHost* rvh, bool RenderViewHostTester::TestOnMessageReceived(RenderViewHost* rvh,
const IPC::Message& msg) { const IPC::Message& msg) {
......
...@@ -55,6 +55,13 @@ class RenderFrameHostTester { ...@@ -55,6 +55,13 @@ class RenderFrameHostTester {
static RenderFrameHost* GetPendingForController( static RenderFrameHost* GetPendingForController(
NavigationController* controller); NavigationController* controller);
// This removes the need to expose
// RenderFrameHostImpl::is_swapped_out() outside of content.
//
// This is safe to call on any RenderFrameHost, not just ones
// constructed while a RenderViewHostTestEnabler is in play.
static bool IsRenderFrameHostSwappedOut(RenderFrameHost* rfh);
virtual ~RenderFrameHostTester() {} virtual ~RenderFrameHostTester() {}
// Gives tests access to RenderFrameHostImpl::OnCreateChild. The returned // Gives tests access to RenderFrameHostImpl::OnCreateChild. The returned
...@@ -97,13 +104,6 @@ class RenderViewHostTester { ...@@ -97,13 +104,6 @@ class RenderViewHostTester {
// RenderViewHostTestEnabler instance (see below) to do this. // RenderViewHostTestEnabler instance (see below) to do this.
static RenderViewHostTester* For(RenderViewHost* host); static RenderViewHostTester* For(RenderViewHost* host);
// This removes the need to expose
// RenderViewHostImpl::is_swapped_out() outside of content.
//
// This is safe to call on any RenderViewHost, not just ones
// constructed while a RenderViewHostTestEnabler is in play.
static bool IsRenderViewHostSwappedOut(RenderViewHost* rvh);
// Calls the RenderViewHosts' private OnMessageReceived function with the // Calls the RenderViewHosts' private OnMessageReceived function with the
// given message. // given message.
static bool TestOnMessageReceived(RenderViewHost* rvh, static bool TestOnMessageReceived(RenderViewHost* rvh,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment