| OLD | NEW |
| 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> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Utility function to initialize FrameHostMsg_DidCommitProvisionalLoad_Params | 47 // Utility function to initialize FrameHostMsg_DidCommitProvisionalLoad_Params |
| 48 // with given parameters. | 48 // with given parameters. |
| 49 void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params, | 49 void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params, |
| 50 int nav_entry_id, | 50 int nav_entry_id, |
| 51 bool did_create_new_entry, | 51 bool did_create_new_entry, |
| 52 const GURL& url, | 52 const GURL& url, |
| 53 ui::PageTransition transition_type); | 53 ui::PageTransition transition_type); |
| 54 | 54 |
| 55 // TestRenderWidgetHostView ---------------------------------------------------- | 55 // TestRenderWidgetHostView ---------------------------------------------------- |
| 56 | 56 |
| 57 // Subclass the RenderViewHost's view so that we can call Show(), etc., | 57 // Subclass the RenderViewHost's view. |
| 58 // without having side-effects. | |
| 59 class TestRenderWidgetHostView : public RenderWidgetHostViewBase { | 58 class TestRenderWidgetHostView : public RenderWidgetHostViewBase { |
| 60 public: | 59 public: |
| 61 explicit TestRenderWidgetHostView(RenderWidgetHost* rwh); | 60 explicit TestRenderWidgetHostView(RenderWidgetHost* rwh); |
| 62 ~TestRenderWidgetHostView() override; | 61 ~TestRenderWidgetHostView() override; |
| 63 | 62 |
| 64 // RenderWidgetHostView implementation. | 63 // RenderWidgetHostView implementation. |
| 65 void InitAsChild(gfx::NativeView parent_view) override {} | 64 void InitAsChild(gfx::NativeView parent_view) override {} |
| 66 RenderWidgetHost* GetRenderWidgetHost() const override; | 65 RenderWidgetHost* GetRenderWidgetHost() const override; |
| 67 void SetSize(const gfx::Size& size) override {} | 66 void SetSize(const gfx::Size& size) override {} |
| 68 void SetBounds(const gfx::Rect& rect) override {} | 67 void SetBounds(const gfx::Rect& rect) override {} |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 const gfx::Rect& src_subrect, | 108 const gfx::Rect& src_subrect, |
| 110 const scoped_refptr<media::VideoFrame>& target, | 109 const scoped_refptr<media::VideoFrame>& target, |
| 111 const base::Callback<void(const gfx::Rect&, bool)>& callback) override; | 110 const base::Callback<void(const gfx::Rect&, bool)>& callback) override; |
| 112 bool CanCopyToVideoFrame() const override; | 111 bool CanCopyToVideoFrame() const override; |
| 113 bool HasAcceleratedSurface(const gfx::Size& desired_size) override; | 112 bool HasAcceleratedSurface(const gfx::Size& desired_size) override; |
| 114 gfx::Rect GetBoundsInRootWindow() override; | 113 gfx::Rect GetBoundsInRootWindow() override; |
| 115 bool LockMouse() override; | 114 bool LockMouse() override; |
| 116 void UnlockMouse() override; | 115 void UnlockMouse() override; |
| 117 cc::FrameSinkId GetFrameSinkId() override; | 116 cc::FrameSinkId GetFrameSinkId() override; |
| 118 | 117 |
| 119 bool is_showing() const { return is_showing_; } | |
| 120 bool is_occluded() const { return is_occluded_; } | 118 bool is_occluded() const { return is_occluded_; } |
| 121 bool did_swap_compositor_frame() const { return did_swap_compositor_frame_; } | 119 bool did_swap_compositor_frame() const { return did_swap_compositor_frame_; } |
| 122 | 120 |
| 123 protected: | 121 protected: |
| 124 RenderWidgetHostImpl* rwh_; | 122 RenderWidgetHostImpl* rwh_; |
| 125 cc::FrameSinkId frame_sink_id_; | 123 cc::FrameSinkId frame_sink_id_; |
| 126 | 124 |
| 127 private: | 125 private: |
| 128 bool is_showing_; | |
| 129 bool is_occluded_; | 126 bool is_occluded_; |
| 130 bool did_swap_compositor_frame_; | 127 bool did_swap_compositor_frame_; |
| 131 ui::DummyTextInputClient text_input_client_; | 128 ui::DummyTextInputClient text_input_client_; |
| 132 }; | 129 }; |
| 133 | 130 |
| 134 #if defined(COMPILER_MSVC) | 131 #if defined(COMPILER_MSVC) |
| 135 // See comment for same warning on RenderViewHostImpl. | 132 // See comment for same warning on RenderViewHostImpl. |
| 136 #pragma warning(push) | 133 #pragma warning(push) |
| 137 #pragma warning(disable: 4250) | 134 #pragma warning(disable: 4250) |
| 138 #endif | 135 #endif |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 TestRenderViewHost(SiteInstance* instance, | 176 TestRenderViewHost(SiteInstance* instance, |
| 180 std::unique_ptr<RenderWidgetHostImpl> widget, | 177 std::unique_ptr<RenderWidgetHostImpl> widget, |
| 181 RenderViewHostDelegate* delegate, | 178 RenderViewHostDelegate* delegate, |
| 182 int32_t main_frame_routing_id, | 179 int32_t main_frame_routing_id, |
| 183 bool swapped_out); | 180 bool swapped_out); |
| 184 ~TestRenderViewHost() override; | 181 ~TestRenderViewHost() override; |
| 185 | 182 |
| 186 // RenderViewHostTester implementation. Note that CreateRenderView | 183 // RenderViewHostTester implementation. Note that CreateRenderView |
| 187 // is not specified since it is synonymous with the one from | 184 // is not specified since it is synonymous with the one from |
| 188 // RenderViewHostImpl, see below. | 185 // RenderViewHostImpl, see below. |
| 189 void SimulateWasHidden() override; | |
| 190 void SimulateWasShown() override; | |
| 191 WebPreferences TestComputeWebkitPrefs() override; | 186 WebPreferences TestComputeWebkitPrefs() override; |
| 192 | 187 |
| 193 void TestOnUpdateStateWithFile(const base::FilePath& file_path); | 188 void TestOnUpdateStateWithFile(const base::FilePath& file_path); |
| 194 | 189 |
| 195 void TestOnStartDragging(const DropData& drop_data); | 190 void TestOnStartDragging(const DropData& drop_data); |
| 196 | 191 |
| 197 // If set, *delete_counter is incremented when this object destructs. | 192 // If set, *delete_counter is incremented when this object destructs. |
| 198 void set_delete_counter(int* delete_counter) { | 193 void set_delete_counter(int* delete_counter) { |
| 199 delete_counter_ = delete_counter; | 194 delete_counter_ = delete_counter; |
| 200 } | 195 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 private: | 294 private: |
| 300 typedef std::unique_ptr<ui::test::ScopedSetSupportedScaleFactors> | 295 typedef std::unique_ptr<ui::test::ScopedSetSupportedScaleFactors> |
| 301 ScopedSetSupportedScaleFactors; | 296 ScopedSetSupportedScaleFactors; |
| 302 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; | 297 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; |
| 303 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); | 298 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); |
| 304 }; | 299 }; |
| 305 | 300 |
| 306 } // namespace content | 301 } // namespace content |
| 307 | 302 |
| 308 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ | 303 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ |
| OLD | NEW |