Commit ddc9d534 authored by nick's avatar nick Committed by Commit bot

Add covariant overrides to TestRVH::GetProcess and TestRFH::GetProcess

that return the MockRenderProcessHost.

Preamble to a fix for bug 474231, where I'll add a new method to
MockRenderProcessHost.

BUG=474231

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

Cr-Commit-Position: refs/heads/master@{#325472}
parent 54d76753
...@@ -3313,8 +3313,7 @@ TEST_F(NavigationControllerTest, IsInPageNavigation) { ...@@ -3313,8 +3313,7 @@ TEST_F(NavigationControllerTest, IsInPageNavigation) {
// Test allow_universal_access_from_file_urls flag. // Test allow_universal_access_from_file_urls flag.
const GURL different_origin_url("http://www.example.com"); const GURL different_origin_url("http://www.example.com");
MockRenderProcessHost* rph = MockRenderProcessHost* rph = main_test_rfh()->GetProcess();
static_cast<MockRenderProcessHost*>(main_test_rfh()->GetProcess());
WebPreferences prefs = test_rvh()->GetWebkitPreferences(); WebPreferences prefs = test_rvh()->GetWebkitPreferences();
prefs.allow_universal_access_from_file_urls = true; prefs.allow_universal_access_from_file_urls = true;
test_rvh()->UpdateWebkitPreferences(prefs); test_rvh()->UpdateWebkitPreferences(prefs);
......
...@@ -84,12 +84,10 @@ class NavigatorTestWithBrowserSideNavigation ...@@ -84,12 +84,10 @@ class NavigatorTestWithBrowserSideNavigation
// Note: caller must invoke ClearMessages on the sink at some point before // Note: caller must invoke ClearMessages on the sink at some point before
// the tracked commit happens to clear up commit messages from previous // the tracked commit happens to clear up commit messages from previous
// navigations. // navigations.
bool DidRenderFrameHostRequestCommit(RenderFrameHostImpl* rfh) { bool DidRenderFrameHostRequestCommit(TestRenderFrameHost* rfh) {
MockRenderProcessHost* rph =
static_cast<MockRenderProcessHost*>(rfh->GetProcess());
const FrameMsg_CommitNavigation* commit_message = const FrameMsg_CommitNavigation* commit_message =
static_cast<const FrameMsg_CommitNavigation*>( static_cast<const FrameMsg_CommitNavigation*>(
rph->sink().GetUniqueMessageMatching( rfh->GetProcess()->sink().GetUniqueMessageMatching(
FrameMsg_CommitNavigation::ID)); FrameMsg_CommitNavigation::ID));
return commit_message && return commit_message &&
rfh->GetRoutingID() == commit_message->routing_id(); rfh->GetRoutingID() == commit_message->routing_id();
...@@ -938,9 +936,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, ...@@ -938,9 +936,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation,
// Now go back to the initial site so that the swapped out RenderFrameHost // Now go back to the initial site so that the swapped out RenderFrameHost
// should be reused. // should be reused.
process()->sink().ClearMessages(); process()->sink().ClearMessages();
static_cast<MockRenderProcessHost*>(rfh1->GetProcess()) rfh1->GetProcess()->sink().ClearMessages();
->sink()
.ClearMessages();
RequestNavigation(node, kUrl1); RequestNavigation(node, kUrl1);
EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); EXPECT_FALSE(GetSpeculativeRenderFrameHost(node));
......
...@@ -563,8 +563,7 @@ TEST_F(RenderFrameHostManagerTest, FilterMessagesWhileSwappedOut) { ...@@ -563,8 +563,7 @@ TEST_F(RenderFrameHostManagerTest, FilterMessagesWhileSwappedOut) {
// be left waiting for a reply. We pick RunBeforeUnloadConfirm as an example // be left waiting for a reply. We pick RunBeforeUnloadConfirm as an example
// that can run easily within a unit test, and that needs to receive a reply // that can run easily within a unit test, and that needs to receive a reply
// without showing an actual dialog. // without showing an actual dialog.
MockRenderProcessHost* ntp_process_host = MockRenderProcessHost* ntp_process_host = ntp_rfh->GetProcess();
static_cast<MockRenderProcessHost*>(ntp_rfh->GetProcess());
ntp_process_host->sink().ClearMessages(); ntp_process_host->sink().ClearMessages();
const base::string16 msg = base::ASCIIToUTF16("Message"); const base::string16 msg = base::ASCIIToUTF16("Message");
bool result = false; bool result = false;
...@@ -636,8 +635,7 @@ TEST_F(RenderFrameHostManagerTest, WhiteListSwapCompositorFrame) { ...@@ -636,8 +635,7 @@ TEST_F(RenderFrameHostManagerTest, WhiteListSwapCompositorFrame) {
swapped_out_rfh->GetRenderViewHost()->GetView()); swapped_out_rfh->GetRenderViewHost()->GetView());
EXPECT_FALSE(swapped_out_rwhv->did_swap_compositor_frame()); EXPECT_FALSE(swapped_out_rwhv->did_swap_compositor_frame());
MockRenderProcessHost* process_host = MockRenderProcessHost* process_host = swapped_out_rfh->GetProcess();
static_cast<MockRenderProcessHost*>(swapped_out_rfh->GetProcess());
process_host->sink().ClearMessages(); process_host->sink().ClearMessages();
cc::CompositorFrame frame; cc::CompositorFrame frame;
......
...@@ -67,6 +67,10 @@ TestRenderViewHost* TestRenderFrameHost::GetRenderViewHost() { ...@@ -67,6 +67,10 @@ TestRenderViewHost* TestRenderFrameHost::GetRenderViewHost() {
RenderFrameHostImpl::GetRenderViewHost()); RenderFrameHostImpl::GetRenderViewHost());
} }
MockRenderProcessHost* TestRenderFrameHost::GetProcess() {
return static_cast<MockRenderProcessHost*>(RenderFrameHostImpl::GetProcess());
}
TestRenderFrameHost* TestRenderFrameHost::AppendChild( TestRenderFrameHost* TestRenderFrameHost::AppendChild(
const std::string& frame_name) { const std::string& frame_name) {
OnCreateChildFrame(GetProcess()->GetNextRoutingID(), frame_name, OnCreateChildFrame(GetProcess()->GetNextRoutingID(), frame_name,
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "content/public/test/mock_render_process_host.h"
#include "content/public/test/test_renderer_host.h" #include "content/public/test/test_renderer_host.h"
#include "content/test/test_render_view_host.h" #include "content/test/test_render_view_host.h"
#include "ui/base/page_transition_types.h" #include "ui/base/page_transition_types.h"
...@@ -45,8 +46,9 @@ class TestRenderFrameHost : public RenderFrameHostImpl, ...@@ -45,8 +46,9 @@ class TestRenderFrameHost : public RenderFrameHostImpl,
int flags); int flags);
~TestRenderFrameHost() override; ~TestRenderFrameHost() override;
// RenderFrameHostImpl overrides (same values, but in Test* types) // RenderFrameHostImpl overrides (same values, but in Test*/Mock* types)
TestRenderViewHost* GetRenderViewHost() override; TestRenderViewHost* GetRenderViewHost() override;
MockRenderProcessHost* GetProcess() override;
// RenderFrameHostTester implementation. // RenderFrameHostTester implementation.
TestRenderFrameHost* AppendChild(const std::string& frame_name) override; TestRenderFrameHost* AppendChild(const std::string& frame_name) override;
......
...@@ -253,6 +253,10 @@ bool TestRenderViewHost::IsFullscreenGranted() const { ...@@ -253,6 +253,10 @@ bool TestRenderViewHost::IsFullscreenGranted() const {
return RenderViewHostImpl::IsFullscreenGranted(); return RenderViewHostImpl::IsFullscreenGranted();
} }
MockRenderProcessHost* TestRenderViewHost::GetProcess() const {
return static_cast<MockRenderProcessHost*>(RenderViewHostImpl::GetProcess());
}
void TestRenderViewHost::SimulateWasHidden() { void TestRenderViewHost::SimulateWasHidden() {
WasHidden(); WasHidden();
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/public/common/web_preferences.h" #include "content/public/common/web_preferences.h"
#include "content/public/test/mock_render_process_host.h"
#include "content/public/test/test_renderer_host.h" #include "content/public/test/test_renderer_host.h"
#include "ui/base/ime/dummy_text_input_client.h" #include "ui/base/ime/dummy_text_input_client.h"
#include "ui/base/layout.h" #include "ui/base/layout.h"
...@@ -134,9 +135,9 @@ class TestRenderWidgetHostView : public RenderWidgetHostViewBase { ...@@ -134,9 +135,9 @@ class TestRenderWidgetHostView : public RenderWidgetHostViewBase {
bool LockMouse() override; bool LockMouse() override;
void UnlockMouse() override; void UnlockMouse() override;
#if defined(OS_WIN) #if defined(OS_WIN)
virtual void SetParentNativeViewAccessible( void SetParentNativeViewAccessible(
gfx::NativeViewAccessible accessible_parent) override; gfx::NativeViewAccessible accessible_parent) override;
virtual gfx::NativeViewId GetParentForWindowlessPlugin() const override; gfx::NativeViewId GetParentForWindowlessPlugin() const override;
#endif #endif
bool is_showing() const { return is_showing_; } bool is_showing() const { return is_showing_; }
...@@ -233,6 +234,9 @@ class TestRenderViewHost ...@@ -233,6 +234,9 @@ class TestRenderViewHost
// The opener route id passed to CreateRenderView(). // The opener route id passed to CreateRenderView().
int opener_route_id() const { return opener_route_id_; } int opener_route_id() const { return opener_route_id_; }
// RenderWidgetHost overrides (same value, but in the Mock* type)
MockRenderProcessHost* GetProcess() const override;
// RenderViewHost overrides -------------------------------------------------- // RenderViewHost overrides --------------------------------------------------
bool CreateRenderView(const base::string16& frame_name, bool CreateRenderView(const base::string16& frame_name,
......
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