Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: content/browser/renderer_host/test_render_view_host.h

Issue 9347042: Introduce content::RenderWidgetHostViewPort (in content/port/browser). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "content/browser/renderer_host/mock_render_process_host.h" 13 #include "content/browser/renderer_host/mock_render_process_host.h"
14 #include "content/browser/renderer_host/render_view_host.h" 14 #include "content/browser/renderer_host/render_view_host.h"
15 #include "content/browser/renderer_host/render_view_host_factory.h" 15 #include "content/browser/renderer_host/render_view_host_factory.h"
16 #include "content/browser/renderer_host/render_widget_host_view.h" 16 #include "content/browser/renderer_host/render_widget_host_view_base.h"
17 #include "content/public/common/page_transition_types.h" 17 #include "content/public/common/page_transition_types.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 namespace content { 20 namespace content {
21 class BrowserContext; 21 class BrowserContext;
22 class NavigationController; 22 class NavigationController;
23 class RenderProcessHostFactory; 23 class RenderProcessHostFactory;
24 class SiteInstance; 24 class SiteInstance;
25 } 25 }
26 26
(...skipping 16 matching lines...) Expand all
43 TransportDIB::Id bitmap, 43 TransportDIB::Id bitmap,
44 const gfx::Rect& rect); 44 const gfx::Rect& rect);
45 45
46 // This file provides a testing framework for mocking out the RenderProcessHost 46 // This file provides a testing framework for mocking out the RenderProcessHost
47 // layer. It allows you to test RenderViewHost, TabContents, 47 // layer. It allows you to test RenderViewHost, TabContents,
48 // NavigationController, and other layers above that without running an actual 48 // NavigationController, and other layers above that without running an actual
49 // renderer process. 49 // renderer process.
50 // 50 //
51 // To use, derive your test base class from RenderViewHostTestHarness. 51 // To use, derive your test base class from RenderViewHostTestHarness.
52 52
53
54 namespace content {
55
53 // TestRenderViewHostView ------------------------------------------------------ 56 // TestRenderViewHostView ------------------------------------------------------
54 57
55 // Subclass the RenderViewHost's view so that we can call Show(), etc., 58 // Subclass the RenderViewHost's view so that we can call Show(), etc.,
56 // without having side-effects. 59 // without having side-effects.
57 class TestRenderWidgetHostView : public RenderWidgetHostViewBase { 60 class TestRenderWidgetHostView : public RenderWidgetHostViewBase {
58 public: 61 public:
59 explicit TestRenderWidgetHostView(RenderWidgetHost* rwh); 62 explicit TestRenderWidgetHostView(RenderWidgetHost* rwh);
60 virtual ~TestRenderWidgetHostView(); 63 virtual ~TestRenderWidgetHostView();
61 64
62 // RenderWidgetHostView implementation. 65 // RenderWidgetHostView implementation.
(...skipping 17 matching lines...) Expand all
80 #endif // defined(OS_MACOSX) 83 #endif // defined(OS_MACOSX)
81 #if defined(TOOLKIT_USES_GTK) 84 #if defined(TOOLKIT_USES_GTK)
82 virtual GdkEventButton* GetLastMouseDown() OVERRIDE; 85 virtual GdkEventButton* GetLastMouseDown() OVERRIDE;
83 #if !defined(TOOLKIT_VIEWS) 86 #if !defined(TOOLKIT_VIEWS)
84 virtual gfx::NativeView BuildInputMethodsGtkMenu() OVERRIDE; 87 virtual gfx::NativeView BuildInputMethodsGtkMenu() OVERRIDE;
85 #endif // !defined(TOOLKIT_VIEWS) 88 #endif // !defined(TOOLKIT_VIEWS)
86 #endif // defined(TOOLKIT_USES_GTK) 89 #endif // defined(TOOLKIT_USES_GTK)
87 virtual void UnhandledWheelEvent( 90 virtual void UnhandledWheelEvent(
88 const WebKit::WebMouseWheelEvent& event) OVERRIDE {} 91 const WebKit::WebMouseWheelEvent& event) OVERRIDE {}
89 92
90 // RenderWidgetHostViewBase implementation. 93 // RenderWidgetHostViewPort implementation.
91 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, 94 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
92 const gfx::Rect& pos) OVERRIDE {} 95 const gfx::Rect& pos) OVERRIDE {}
93 virtual void InitAsFullscreen( 96 virtual void InitAsFullscreen(
94 RenderWidgetHostView* reference_host_view) OVERRIDE {} 97 RenderWidgetHostView* reference_host_view) OVERRIDE {}
95 virtual void DidBecomeSelected() OVERRIDE {} 98 virtual void DidBecomeSelected() OVERRIDE {}
96 virtual void WasHidden() OVERRIDE {} 99 virtual void WasHidden() OVERRIDE {}
97 virtual void MovePluginWindows( 100 virtual void MovePluginWindows(
98 const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE {} 101 const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE {}
99 virtual void Focus() OVERRIDE {} 102 virtual void Focus() OVERRIDE {}
100 virtual void Blur() OVERRIDE {} 103 virtual void Blur() OVERRIDE {}
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 virtual bool LockMouse() OVERRIDE; 173 virtual bool LockMouse() OVERRIDE;
171 virtual void UnlockMouse() OVERRIDE; 174 virtual void UnlockMouse() OVERRIDE;
172 175
173 bool is_showing() const { return is_showing_; } 176 bool is_showing() const { return is_showing_; }
174 177
175 private: 178 private:
176 RenderWidgetHost* rwh_; 179 RenderWidgetHost* rwh_;
177 bool is_showing_; 180 bool is_showing_;
178 }; 181 };
179 182
183 } // namespace content
184
180 // TestRenderViewHost ---------------------------------------------------------- 185 // TestRenderViewHost ----------------------------------------------------------
181 186
182 // TODO(brettw) this should use a TestTabContents which should be generalized 187 // TODO(brettw) this should use a TestTabContents which should be generalized
183 // from the TabContents test. We will probably also need that class' version of 188 // from the TabContents test. We will probably also need that class' version of
184 // CreateRenderViewForRenderManager when more complicate tests start using this. 189 // CreateRenderViewForRenderManager when more complicate tests start using this.
185 class TestRenderViewHost : public RenderViewHost { 190 class TestRenderViewHost : public RenderViewHost {
186 public: 191 public:
187 // If the given TabContnets has a pending RVH, returns it, otherwise NULL. 192 // If the given TabContnets has a pending RVH, returns it, otherwise NULL.
188 static TestRenderViewHost* GetPendingForController( 193 static TestRenderViewHost* GetPendingForController(
189 content::NavigationController* controller); 194 content::NavigationController* controller);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 MockRenderProcessHostFactory rph_factory_; 366 MockRenderProcessHostFactory rph_factory_;
362 TestRenderViewHostFactory rvh_factory_; 367 TestRenderViewHostFactory rvh_factory_;
363 368
364 private: 369 private:
365 scoped_ptr<TestTabContents> contents_; 370 scoped_ptr<TestTabContents> contents_;
366 371
367 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); 372 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness);
368 }; 373 };
369 374
370 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ 375 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_win.cc ('k') | content/browser/renderer_host/test_render_view_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698