| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 171 |
| 170 bool is_showing() const { return is_showing_; } | 172 bool is_showing() const { return is_showing_; } |
| 171 bool did_swap_compositor_frame() const { return did_swap_compositor_frame_; } | 173 bool did_swap_compositor_frame() const { return did_swap_compositor_frame_; } |
| 172 | 174 |
| 173 protected: | 175 protected: |
| 174 RenderWidgetHostImpl* rwh_; | 176 RenderWidgetHostImpl* rwh_; |
| 175 | 177 |
| 176 private: | 178 private: |
| 177 bool is_showing_; | 179 bool is_showing_; |
| 178 bool did_swap_compositor_frame_; | 180 bool did_swap_compositor_frame_; |
| 181 ui::DummyTextInputClient text_input_client_; |
| 179 }; | 182 }; |
| 180 | 183 |
| 181 #if defined(COMPILER_MSVC) | 184 #if defined(COMPILER_MSVC) |
| 182 // See comment for same warning on RenderViewHostImpl. | 185 // See comment for same warning on RenderViewHostImpl. |
| 183 #pragma warning(push) | 186 #pragma warning(push) |
| 184 #pragma warning(disable: 4250) | 187 #pragma warning(disable: 4250) |
| 185 #endif | 188 #endif |
| 186 | 189 |
| 187 // TestRenderViewHost ---------------------------------------------------------- | 190 // TestRenderViewHost ---------------------------------------------------------- |
| 188 | 191 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 private: | 385 private: |
| 383 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> | 386 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> |
| 384 ScopedSetSupportedScaleFactors; | 387 ScopedSetSupportedScaleFactors; |
| 385 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; | 388 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; |
| 386 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); | 389 DISALLOW_COPY_AND_ASSIGN(RenderViewHostImplTestHarness); |
| 387 }; | 390 }; |
| 388 | 391 |
| 389 } // namespace content | 392 } // namespace content |
| 390 | 393 |
| 391 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ | 394 #endif // CONTENT_TEST_TEST_RENDER_VIEW_HOST_H_ |
| OLD | NEW |