| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "content/browser/renderer_host/render_view_host_impl.h" | 14 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 15 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 15 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 16 #include "content/public/common/page_transition_types.h" | 16 #include "content/public/common/page_transition_types.h" |
| 17 #include "content/public/test/test_renderer_host.h" | 17 #include "content/public/test/test_renderer_host.h" |
| 18 #include "content/test/test_render_frame_host.h" | 18 #include "content/test/test_render_frame_host.h" |
| 19 #include "ui/base/ime/dummy_text_input_client.h" |
| 19 #include "ui/base/layout.h" | 20 #include "ui/base/layout.h" |
| 20 #include "ui/gfx/vector2d_f.h" | 21 #include "ui/gfx/vector2d_f.h" |
| 21 | 22 |
| 22 // This file provides a testing framework for mocking out the RenderProcessHost | 23 // This file provides a testing framework for mocking out the RenderProcessHost |
| 23 // layer. It allows you to test RenderViewHost, WebContentsImpl, | 24 // layer. It allows you to test RenderViewHost, WebContentsImpl, |
| 24 // NavigationController, and other layers above that without running an actual | 25 // NavigationController, and other layers above that without running an actual |
| 25 // renderer process. | 26 // renderer process. |
| 26 // | 27 // |
| 27 // To use, derive your test base class from RenderViewHostImplTestHarness. | 28 // To use, derive your test base class from RenderViewHostImplTestHarness. |
| 28 | 29 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 55 virtual ~TestRenderWidgetHostView(); | 56 virtual ~TestRenderWidgetHostView(); |
| 56 | 57 |
| 57 // RenderWidgetHostView implementation. | 58 // RenderWidgetHostView implementation. |
| 58 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE {} | 59 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE {} |
| 59 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; | 60 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; |
| 60 virtual void SetSize(const gfx::Size& size) OVERRIDE {} | 61 virtual void SetSize(const gfx::Size& size) OVERRIDE {} |
| 61 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE {} | 62 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE {} |
| 62 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 63 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 63 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; | 64 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; |
| 64 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; | 65 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; |
| 66 virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; |
| 65 virtual bool HasFocus() const OVERRIDE; | 67 virtual bool HasFocus() const OVERRIDE; |
| 66 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE; | 68 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE; |
| 67 virtual void Show() OVERRIDE; | 69 virtual void Show() OVERRIDE; |
| 68 virtual void Hide() OVERRIDE; | 70 virtual void Hide() OVERRIDE; |
| 69 virtual bool IsShowing() OVERRIDE; | 71 virtual bool IsShowing() OVERRIDE; |
| 70 virtual gfx::Rect GetViewBounds() const OVERRIDE; | 72 virtual gfx::Rect GetViewBounds() const OVERRIDE; |
| 71 #if defined(OS_MACOSX) | 73 #if defined(OS_MACOSX) |
| 72 virtual void SetActive(bool active) OVERRIDE; | 74 virtual void SetActive(bool active) OVERRIDE; |
| 73 virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE {} | 75 virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE {} |
| 74 virtual void SetWindowVisibility(bool visible) OVERRIDE {} | 76 virtual void SetWindowVisibility(bool visible) OVERRIDE {} |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 176 |
| 175 bool is_showing() const { return is_showing_; } | 177 bool is_showing() const { return is_showing_; } |
| 176 bool did_swap_compositor_frame() const { return did_swap_compositor_frame_; } | 178 bool did_swap_compositor_frame() const { return did_swap_compositor_frame_; } |
| 177 | 179 |
| 178 protected: | 180 protected: |
| 179 RenderWidgetHostImpl* rwh_; | 181 RenderWidgetHostImpl* rwh_; |
| 180 | 182 |
| 181 private: | 183 private: |
| 182 bool is_showing_; | 184 bool is_showing_; |
| 183 bool did_swap_compositor_frame_; | 185 bool did_swap_compositor_frame_; |
| 186 ui::DummyTextInputClient text_input_client_; |
| 184 }; | 187 }; |
| 185 | 188 |
| 186 #if defined(COMPILER_MSVC) | 189 #if defined(COMPILER_MSVC) |
| 187 // See comment for same warning on RenderViewHostImpl. | 190 // See comment for same warning on RenderViewHostImpl. |
| 188 #pragma warning(push) | 191 #pragma warning(push) |
| 189 #pragma warning(disable: 4250) | 192 #pragma warning(disable: 4250) |
| 190 #endif | 193 #endif |
| 191 | 194 |
| 192 // TestRenderViewHost ---------------------------------------------------------- | 195 // TestRenderViewHost ---------------------------------------------------------- |
| 193 | 196 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 private: | 389 private: |
| 387 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> | 390 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> |
| 388 ScopedSetSupportedScaleFactors; | 391 ScopedSetSupportedScaleFactors; |
| 389 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; | 392 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; |
| 390 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); | 393 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); |
| 391 }; | 394 }; |
| 392 | 395 |
| 393 } // namespace content | 396 } // namespace content |
| 394 | 397 |
| 395 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ | 398 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ |
| OLD | NEW |