class TestRenderWidgetHostView : public RenderWidgetHostViewBase {
public:
explicit TestRenderWidgetHostView(RenderWidgetHost* rwh);
- virtual ~TestRenderWidgetHostView();
+ ~TestRenderWidgetHostView() override;
// RenderWidgetHostView implementation.
- virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE {}
- virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE;
- virtual void SetSize(const gfx::Size& size) OVERRIDE {}
- virtual void SetBounds(const gfx::Rect& rect) OVERRIDE {}
- virtual gfx::Vector2dF GetLastScrollOffset() const OVERRIDE;
- virtual gfx::NativeView GetNativeView() const OVERRIDE;
- virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
- virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE;
- virtual ui::TextInputClient* GetTextInputClient() OVERRIDE;
- virtual bool HasFocus() const OVERRIDE;
- virtual bool IsSurfaceAvailableForCopy() const OVERRIDE;
- virtual void Show() OVERRIDE;
- virtual void Hide() OVERRIDE;
- virtual bool IsShowing() OVERRIDE;
- virtual gfx::Rect GetViewBounds() const OVERRIDE;
+ void InitAsChild(gfx::NativeView parent_view) override {}
+ RenderWidgetHost* GetRenderWidgetHost() const override;
+ void SetSize(const gfx::Size& size) override {}
+ void SetBounds(const gfx::Rect& rect) override {}
+ gfx::Vector2dF GetLastScrollOffset() const override;
+ gfx::NativeView GetNativeView() const override;
+ gfx::NativeViewId GetNativeViewId() const override;
+ gfx::NativeViewAccessible GetNativeViewAccessible() override;
+ ui::TextInputClient* GetTextInputClient() override;
+ bool HasFocus() const override;
+ bool IsSurfaceAvailableForCopy() const override;
+ void Show() override;
+ void Hide() override;
+ bool IsShowing() override;
+ gfx::Rect GetViewBounds() const override;
#if defined(OS_MACOSX)
- virtual void SetActive(bool active) OVERRIDE;
- virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE {}
- virtual void SetWindowVisibility(bool visible) OVERRIDE {}
- virtual void WindowFrameChanged() OVERRIDE {}
- virtual void ShowDefinitionForSelection() OVERRIDE {}
- virtual bool SupportsSpeech() const OVERRIDE;
- virtual void SpeakSelection() OVERRIDE;
- virtual bool IsSpeaking() const OVERRIDE;
- virtual void StopSpeaking() OVERRIDE;
+ void SetActive(bool active) override;
+ void SetWindowVisibility(bool visible) override {}
+ void WindowFrameChanged() override {}
+ void ShowDefinitionForSelection() override {}
+ bool SupportsSpeech() const override;
+ void SpeakSelection() override;
+ bool IsSpeaking() const override;
+ void StopSpeaking() override;
#endif // defined(OS_MACOSX)
- virtual void OnSwapCompositorFrame(
- uint32 output_surface_id,
- scoped_ptr<cc::CompositorFrame> frame) OVERRIDE;
+ void OnSwapCompositorFrame(uint32 output_surface_id,
+ scoped_ptr<cc::CompositorFrame> frame) override;
// RenderWidgetHostViewBase implementation.
- virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
- const gfx::Rect& pos) OVERRIDE {}
- virtual void InitAsFullscreen(
- RenderWidgetHostView* reference_host_view) OVERRIDE {}
- virtual void WasShown() OVERRIDE {}
- virtual void WasHidden() OVERRIDE {}
- virtual void MovePluginWindows(
- const std::vector<WebPluginGeometry>& moves) OVERRIDE {}
- virtual void Focus() OVERRIDE {}
- virtual void Blur() OVERRIDE {}
- virtual void SetIsLoading(bool is_loading) OVERRIDE {}
- virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE {}
- virtual void TextInputTypeChanged(ui::TextInputType type,
- ui::TextInputMode input_mode,
- bool can_compose_inline) OVERRIDE {}
- virtual void ImeCancelComposition() OVERRIDE {}
-#if defined(OS_MACOSX) || defined(USE_AURA)
- virtual void ImeCompositionRangeChanged(
+ void InitAsPopup(RenderWidgetHostView* parent_host_view,
+ const gfx::Rect& pos) override {}
+ void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override {}
+ void WasShown() override {}
+ void WasHidden() override {}
+ void MovePluginWindows(const std::vector<WebPluginGeometry>& moves) override {
+ }
+ void Focus() override {}
+ void Blur() override {}
+ void SetIsLoading(bool is_loading) override {}
+ void UpdateCursor(const WebCursor& cursor) override {}
+ void TextInputTypeChanged(ui::TextInputType type,
+ ui::TextInputMode input_mode,
+ bool can_compose_inline,
+ int flags) override {}
+ void ImeCancelComposition() override {}
+#if defined(OS_MACOSX) || defined(USE_AURA) || defined(OS_ANDROID)
+ void ImeCompositionRangeChanged(
const gfx::Range& range,
- const std::vector<gfx::Rect>& character_bounds) OVERRIDE {}
+ const std::vector<gfx::Rect>& character_bounds) override {}
#endif
- virtual void RenderProcessGone(base::TerminationStatus status,
- int error_code) OVERRIDE;
- virtual void Destroy() OVERRIDE;
- virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE {}
- virtual void SelectionBoundsChanged(
- const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE {}
- virtual void CopyFromCompositingSurface(
- const gfx::Rect& src_subrect,
- const gfx::Size& dst_size,
- CopyFromCompositingSurfaceCallback& callback,
- const SkColorType color_type) OVERRIDE;
- virtual void CopyFromCompositingSurfaceToVideoFrame(
+ void RenderProcessGone(base::TerminationStatus status,
+ int error_code) override;
+ void Destroy() override;
+ void SetTooltipText(const base::string16& tooltip_text) override {}
+ void SelectionBoundsChanged(
+ const ViewHostMsg_SelectionBounds_Params& params) override {}
+ void CopyFromCompositingSurface(const gfx::Rect& src_subrect,
+ const gfx::Size& dst_size,
+ CopyFromCompositingSurfaceCallback& callback,
+ const SkColorType color_type) override;
+ void CopyFromCompositingSurfaceToVideoFrame(
const gfx::Rect& src_subrect,
const scoped_refptr<media::VideoFrame>& target,
- const base::Callback<void(bool)>& callback) OVERRIDE;
- virtual bool CanCopyToVideoFrame() const OVERRIDE;
- virtual void AcceleratedSurfaceInitialized(int host_id,
- int route_id) OVERRIDE;
- virtual void AcceleratedSurfaceBuffersSwapped(
- const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
- int gpu_host_id) OVERRIDE;
- virtual void AcceleratedSurfacePostSubBuffer(
- const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
- int gpu_host_id) OVERRIDE;
- virtual void AcceleratedSurfaceSuspend() OVERRIDE;
- virtual void AcceleratedSurfaceRelease() OVERRIDE {}
- virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE;
+ const base::Callback<void(bool)>& callback) override;
+ bool CanCopyToVideoFrame() const override;
+ bool HasAcceleratedSurface(const gfx::Size& desired_size) override;
#if defined(OS_MACOSX)
- virtual bool PostProcessEventForPluginIme(
- const NativeWebKeyboardEvent& event) OVERRIDE;
-#endif
-#if defined(OS_ANDROID) || defined(TOOLKIT_VIEWS) || defined(USE_AURA)
- virtual void ShowDisambiguationPopup(
- const gfx::Rect& rect_pixels,
- const SkBitmap& zoomed_bitmap) OVERRIDE {}
+ bool PostProcessEventForPluginIme(
+ const NativeWebKeyboardEvent& event) override;
#endif
#if defined(OS_ANDROID)
- virtual void LockCompositingSurface() OVERRIDE {}
- virtual void UnlockCompositingSurface() OVERRIDE {}
+ virtual void LockCompositingSurface() override {}
+ virtual void UnlockCompositingSurface() override {}
#endif
- virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE {}
- virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE;
- virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE;
- virtual bool LockMouse() OVERRIDE;
- virtual void UnlockMouse() OVERRIDE;
+ void GetScreenInfo(blink::WebScreenInfo* results) override {}
+ gfx::Rect GetBoundsInRootWindow() override;
+ gfx::GLSurfaceHandle GetCompositingSurface() override;
+ bool LockMouse() override;
+ void UnlockMouse() override;
#if defined(OS_WIN)
virtual void SetParentNativeViewAccessible(
- gfx::NativeViewAccessible accessible_parent) OVERRIDE;
- virtual gfx::NativeViewId GetParentForWindowlessPlugin() const OVERRIDE;
+ gfx::NativeViewAccessible accessible_parent) override;
+ virtual gfx::NativeViewId GetParentForWindowlessPlugin() const override;
#endif
bool is_showing() const { return is_showing_; }
int routing_id,
int main_frame_routing_id,
bool swapped_out);
- virtual ~TestRenderViewHost();
+ ~TestRenderViewHost() override;
// RenderViewHostTester implementation. Note that CreateRenderView
// is not specified since it is synonymous with the one from
// RenderViewHostImpl, see below.
- virtual void SendBeforeUnloadACK(bool proceed) OVERRIDE;
- virtual void SetContentsMimeType(const std::string& mime_type) OVERRIDE;
- virtual void SimulateSwapOutACK() OVERRIDE;
- virtual void SimulateWasHidden() OVERRIDE;
- virtual void SimulateWasShown() OVERRIDE;
-
- // NOTE: These methods are deprecated and the equivalents in
- // TestRenderFrameHost should be used.
- virtual void SendNavigate(int page_id, const GURL& url) OVERRIDE;
- virtual void SendFailedNavigate(int page_id, const GURL& url) OVERRIDE;
- virtual void SendNavigateWithTransition(
- int page_id,
- const GURL& url,
- ui::PageTransition transition) OVERRIDE;
-
- // Calls OnNavigate on the RenderViewHost with the given information,
- // including a custom original request URL. Sets the rest of the
- // parameters in the message to the "typical" values. This is a helper
- // function for simulating the most common types of loads.
- void SendNavigateWithOriginalRequestURL(
- int page_id, const GURL& url, const GURL& original_request_url);
-
- void SendNavigateWithFile(
- int page_id, const GURL& url, const base::FilePath& file_path);
-
- void SendNavigateWithParams(
- FrameHostMsg_DidCommitProvisionalLoad_Params* params);
+ void SimulateWasHidden() override;
+ void SimulateWasShown() override;
void TestOnUpdateStateWithFile(
int page_id, const base::FilePath& file_path);
render_view_created_ = created;
}
- // Returns whether the RenderViewHost is currently waiting to hear the result
- // of a before unload handler from the renderer.
- bool is_waiting_for_beforeunload_ack() const {
- return is_waiting_for_beforeunload_ack_;
- }
-
- // Sets whether the RenderViewHost is currently swapped out, and thus
- // filtering messages from the renderer.
- void set_rvh_state(RenderViewHostImplState rvh_state) {
- rvh_state_ = rvh_state;
- }
-
- // If set, navigations will appear to have loaded through a proxy
- // (ViewHostMsg_FrameNavigte_Params::was_fetched_via_proxy).
- // False by default.
- void set_simulate_fetch_via_proxy(bool proxy);
-
- // If set, navigations will appear to have cleared the history list in the
- // RenderView
- // (FrameHostMsg_DidCommitProvisionalLoad_Params::history_list_was_cleared).
- // False by default.
- void set_simulate_history_list_was_cleared(bool cleared);
-
// The opener route id passed to CreateRenderView().
int opener_route_id() const { return opener_route_id_; }
- // TODO(creis): Remove the need for these methods.
- TestRenderFrameHost* main_render_frame_host() const {
- return main_render_frame_host_;
- }
- void set_main_render_frame_host(TestRenderFrameHost* rfh) {
- main_render_frame_host_ = rfh;
- }
-
// RenderViewHost overrides --------------------------------------------------
- virtual bool CreateRenderView(const base::string16& frame_name,
- int opener_route_id,
- int proxy_route_id,
- int32 max_page_id,
- bool window_was_created_with_opener) OVERRIDE;
- virtual bool IsRenderViewLive() const OVERRIDE;
- virtual bool IsFullscreen() const OVERRIDE;
+ bool CreateRenderView(const base::string16& frame_name,
+ int opener_route_id,
+ int proxy_route_id,
+ int32 max_page_id,
+ bool window_was_created_with_opener) override;
+ bool IsRenderViewLive() const override;
+ bool IsFullscreen() const override;
private:
FRIEND_TEST_ALL_PREFIXES(RenderViewHostTest, FilterNavigate);
// See set_delete_counter() above. May be NULL.
int* delete_counter_;
- // See set_simulate_fetch_via_proxy() above.
- bool simulate_fetch_via_proxy_;
-
- // See set_simulate_history_list_was_cleared() above.
- bool simulate_history_list_was_cleared_;
-
- // See SetContentsMimeType() above.
- std::string contents_mime_type_;
-
// See opener_route_id() above.
int opener_route_id_;
- TestRenderFrameHost* main_render_frame_host_;
-
DISALLOW_COPY_AND_ASSIGN(TestRenderViewHost);
};
class RenderViewHostImplTestHarness : public RenderViewHostTestHarness {
public:
RenderViewHostImplTestHarness();
- virtual ~RenderViewHostImplTestHarness();
+ ~RenderViewHostImplTestHarness() override;
// contents() is equivalent to static_cast<TestWebContents*>(web_contents())
TestWebContents* contents();