OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // renderer process. | 31 // renderer process. |
32 // | 32 // |
33 // To use, derive your test base class from RenderViewHostTestHarness. | 33 // To use, derive your test base class from RenderViewHostTestHarness. |
34 | 34 |
35 // TestRenderViewHostView ------------------------------------------------------ | 35 // TestRenderViewHostView ------------------------------------------------------ |
36 | 36 |
37 // Subclass the RenderViewHost's view so that we can call Show(), etc., | 37 // Subclass the RenderViewHost's view so that we can call Show(), etc., |
38 // without having side-effects. | 38 // without having side-effects. |
39 class TestRenderWidgetHostView : public RenderWidgetHostView { | 39 class TestRenderWidgetHostView : public RenderWidgetHostView { |
40 public: | 40 public: |
41 TestRenderWidgetHostView() : is_showing_(false) {} | 41 explicit TestRenderWidgetHostView(RenderWidgetHost* rwh); |
42 | 42 |
43 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, | 43 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
44 const gfx::Rect& pos) {} | 44 const gfx::Rect& pos) {} |
45 virtual RenderWidgetHost* GetRenderWidgetHost() const { return NULL; } | 45 virtual RenderWidgetHost* GetRenderWidgetHost() const { return NULL; } |
46 virtual void DidBecomeSelected() {} | 46 virtual void DidBecomeSelected() {} |
47 virtual void WasHidden() {} | 47 virtual void WasHidden() {} |
48 virtual void SetSize(const gfx::Size& size) {} | 48 virtual void SetSize(const gfx::Size& size) {} |
49 virtual gfx::NativeView GetNativeView() { return NULL; } | 49 virtual gfx::NativeView GetNativeView() { return NULL; } |
50 virtual void MovePluginWindows( | 50 virtual void MovePluginWindows( |
51 const std::vector<WebPluginGeometry>& plugin_window_moves) {} | 51 const std::vector<WebPluginGeometry>& plugin_window_moves) {} |
(...skipping 23 matching lines...) Expand all Loading... |
75 #if defined(OS_MACOSX) | 75 #if defined(OS_MACOSX) |
76 virtual void ShowPopupWithItems(gfx::Rect bounds, | 76 virtual void ShowPopupWithItems(gfx::Rect bounds, |
77 int item_height, | 77 int item_height, |
78 int selected_item, | 78 int selected_item, |
79 const std::vector<WebMenuItem>& items) {} | 79 const std::vector<WebMenuItem>& items) {} |
80 #endif | 80 #endif |
81 | 81 |
82 bool is_showing() const { return is_showing_; } | 82 bool is_showing() const { return is_showing_; } |
83 | 83 |
84 private: | 84 private: |
| 85 RenderWidgetHost* rwh_; |
85 bool is_showing_; | 86 bool is_showing_; |
86 }; | 87 }; |
87 | 88 |
88 // TestRenderViewHost ---------------------------------------------------------- | 89 // TestRenderViewHost ---------------------------------------------------------- |
89 | 90 |
90 // TODO(brettw) this should use a TestTabContents which should be generalized | 91 // TODO(brettw) this should use a TestTabContents which should be generalized |
91 // from the TabContents test. We will probably also need that class' version of | 92 // from the TabContents test. We will probably also need that class' version of |
92 // CreateRenderViewForRenderManager when more complicate tests start using this. | 93 // CreateRenderViewForRenderManager when more complicate tests start using this. |
93 class TestRenderViewHost : public RenderViewHost { | 94 class TestRenderViewHost : public RenderViewHost { |
94 public: | 95 public: |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 243 |
243 MockRenderProcessHostFactory rph_factory_; | 244 MockRenderProcessHostFactory rph_factory_; |
244 TestRenderViewHostFactory rvh_factory_; | 245 TestRenderViewHostFactory rvh_factory_; |
245 | 246 |
246 scoped_ptr<TestTabContents> contents_; | 247 scoped_ptr<TestTabContents> contents_; |
247 | 248 |
248 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); | 249 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); |
249 }; | 250 }; |
250 | 251 |
251 #endif // CHROME_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ | 252 #endif // CHROME_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ |
OLD | NEW |