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

Side by Side Diff: content/test/test_render_view_host.h

Issue 2861533003: Backfill some UI tests. (Closed)
Patch Set: fix silent merge conflict Created 3 years, 7 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
« no previous file with comments | « chrome/test/BUILD.gn ('k') | content/test/test_render_view_host.cc » ('j') | 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 #ifndef CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ 5 #ifndef CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_
6 #define CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ 6 #define CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "cc/surfaces/frame_sink_id.h" 16 #include "cc/surfaces/frame_sink_id.h"
17 #include "content/browser/renderer_host/render_view_host_impl.h" 17 #include "content/browser/renderer_host/render_view_host_impl.h"
18 #include "content/browser/renderer_host/render_widget_host_view_base.h" 18 #include "content/browser/renderer_host/render_widget_host_view_base.h"
19 #include "content/public/common/web_preferences.h" 19 #include "content/public/common/web_preferences.h"
20 #include "content/public/test/mock_render_process_host.h" 20 #include "content/public/test/mock_render_process_host.h"
21 #include "content/public/test/test_renderer_host.h" 21 #include "content/public/test/test_renderer_host.h"
22 #include "ui/base/ime/dummy_text_input_client.h" 22 #include "ui/base/ime/dummy_text_input_client.h"
23 #include "ui/base/layout.h" 23 #include "ui/base/layout.h"
24 #include "ui/base/page_transition_types.h" 24 #include "ui/base/page_transition_types.h"
25 #include "ui/gfx/geometry/vector2d_f.h" 25 #include "ui/gfx/geometry/vector2d_f.h"
26 26
27 #if defined(USE_AURA)
28 #include "ui/aura/window.h"
29 #endif
30
27 // This file provides a testing framework for mocking out the RenderProcessHost 31 // This file provides a testing framework for mocking out the RenderProcessHost
28 // layer. It allows you to test RenderViewHost, WebContentsImpl, 32 // layer. It allows you to test RenderViewHost, WebContentsImpl,
29 // NavigationController, and other layers above that without running an actual 33 // NavigationController, and other layers above that without running an actual
30 // renderer process. 34 // renderer process.
31 // 35 //
32 // To use, derive your test base class from RenderViewHostImplTestHarness. 36 // To use, derive your test base class from RenderViewHostImplTestHarness.
33 37
34 struct FrameHostMsg_DidCommitProvisionalLoad_Params; 38 struct FrameHostMsg_DidCommitProvisionalLoad_Params;
35 39
36 namespace gfx { 40 namespace gfx {
(...skipping 17 matching lines...) Expand all
54 58
55 // TestRenderWidgetHostView ---------------------------------------------------- 59 // TestRenderWidgetHostView ----------------------------------------------------
56 60
57 // Subclass the RenderViewHost's view so that we can call Show(), etc., 61 // Subclass the RenderViewHost's view so that we can call Show(), etc.,
58 // without having side-effects. 62 // without having side-effects.
59 class TestRenderWidgetHostView : public RenderWidgetHostViewBase { 63 class TestRenderWidgetHostView : public RenderWidgetHostViewBase {
60 public: 64 public:
61 explicit TestRenderWidgetHostView(RenderWidgetHost* rwh); 65 explicit TestRenderWidgetHostView(RenderWidgetHost* rwh);
62 ~TestRenderWidgetHostView() override; 66 ~TestRenderWidgetHostView() override;
63 67
64 // RenderWidgetHostView implementation. 68 // RenderWidgetHostView:
65 void InitAsChild(gfx::NativeView parent_view) override {} 69 void InitAsChild(gfx::NativeView parent_view) override {}
66 RenderWidgetHost* GetRenderWidgetHost() const override; 70 RenderWidgetHost* GetRenderWidgetHost() const override;
67 void SetSize(const gfx::Size& size) override {} 71 void SetSize(const gfx::Size& size) override {}
68 void SetBounds(const gfx::Rect& rect) override {} 72 void SetBounds(const gfx::Rect& rect) override {}
69 gfx::Vector2dF GetLastScrollOffset() const override; 73 gfx::Vector2dF GetLastScrollOffset() const override;
70 gfx::NativeView GetNativeView() const override; 74 gfx::NativeView GetNativeView() const override;
71 gfx::NativeViewAccessible GetNativeViewAccessible() override; 75 gfx::NativeViewAccessible GetNativeViewAccessible() override;
72 ui::TextInputClient* GetTextInputClient() override; 76 ui::TextInputClient* GetTextInputClient() override;
73 bool HasFocus() const override; 77 bool HasFocus() const override;
74 void Show() override; 78 void Show() override;
(...skipping 14 matching lines...) Expand all
89 void StopSpeaking() override; 93 void StopSpeaking() override;
90 #endif // defined(OS_MACOSX) 94 #endif // defined(OS_MACOSX)
91 void DidCreateNewRendererCompositorFrameSink( 95 void DidCreateNewRendererCompositorFrameSink(
92 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink) 96 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink)
93 override; 97 override;
94 void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, 98 void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id,
95 cc::CompositorFrame frame) override; 99 cc::CompositorFrame frame) override;
96 void ClearCompositorFrame() override {} 100 void ClearCompositorFrame() override {}
97 void SetNeedsBeginFrames(bool needs_begin_frames) override {} 101 void SetNeedsBeginFrames(bool needs_begin_frames) override {}
98 102
99 // RenderWidgetHostViewBase implementation. 103 // RenderWidgetHostViewBase:
100 void InitAsPopup(RenderWidgetHostView* parent_host_view, 104 void InitAsPopup(RenderWidgetHostView* parent_host_view,
101 const gfx::Rect& bounds) override {} 105 const gfx::Rect& bounds) override {}
102 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override {} 106 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override {}
103 void Focus() override {} 107 void Focus() override {}
104 void SetIsLoading(bool is_loading) override {} 108 void SetIsLoading(bool is_loading) override {}
105 void UpdateCursor(const WebCursor& cursor) override {} 109 void UpdateCursor(const WebCursor& cursor) override {}
106 void RenderProcessGone(base::TerminationStatus status, 110 void RenderProcessGone(base::TerminationStatus status,
107 int error_code) override; 111 int error_code) override;
108 void Destroy() override; 112 void Destroy() override;
109 void SetTooltipText(const base::string16& tooltip_text) override {} 113 void SetTooltipText(const base::string16& tooltip_text) override {}
(...skipping 18 matching lines...) Expand all
128 RenderWidgetHostImpl* rwh_; 132 RenderWidgetHostImpl* rwh_;
129 cc::FrameSinkId frame_sink_id_; 133 cc::FrameSinkId frame_sink_id_;
130 134
131 private: 135 private:
132 bool is_showing_; 136 bool is_showing_;
133 bool is_occluded_; 137 bool is_occluded_;
134 bool did_swap_compositor_frame_; 138 bool did_swap_compositor_frame_;
135 bool did_change_compositor_frame_sink_ = false; 139 bool did_change_compositor_frame_sink_ = false;
136 SkColor background_color_; 140 SkColor background_color_;
137 ui::DummyTextInputClient text_input_client_; 141 ui::DummyTextInputClient text_input_client_;
142
143 #if defined(USE_AURA)
144 std::unique_ptr<aura::Window> window_;
145 #endif
138 }; 146 };
139 147
140 #if defined(COMPILER_MSVC) 148 #if defined(COMPILER_MSVC)
141 // See comment for same warning on RenderViewHostImpl. 149 // See comment for same warning on RenderViewHostImpl.
142 #pragma warning(push) 150 #pragma warning(push)
143 #pragma warning(disable: 4250) 151 #pragma warning(disable: 4250)
144 #endif 152 #endif
145 153
146 // TestRenderViewHost ---------------------------------------------------------- 154 // TestRenderViewHost ----------------------------------------------------------
147 155
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 private: 313 private:
306 typedef std::unique_ptr<ui::test::ScopedSetSupportedScaleFactors> 314 typedef std::unique_ptr<ui::test::ScopedSetSupportedScaleFactors>
307 ScopedSetSupportedScaleFactors; 315 ScopedSetSupportedScaleFactors;
308 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; 316 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_;
309 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); 317 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness);
310 }; 318 };
311 319
312 } // namespace content 320 } // namespace content
313 321
314 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ 322 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_
OLDNEW
« no previous file with comments | « chrome/test/BUILD.gn ('k') | content/test/test_render_view_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698