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