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

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

Issue 9146028: Define the public interface for content browser SiteInstance. This interface is implemented by th... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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.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 } 25 }
25 26
26 namespace gfx { 27 namespace gfx {
27 class Rect; 28 class Rect;
28 } 29 }
29 30
30 class SiteInstance;
31 class TestTabContents; 31 class TestTabContents;
32 struct ViewHostMsg_FrameNavigate_Params; 32 struct ViewHostMsg_FrameNavigate_Params;
33 33
34 // Utility function to initialize ViewHostMsg_NavigateParams_Params 34 // Utility function to initialize ViewHostMsg_NavigateParams_Params
35 // with given |page_id|, |url| and |transition_type|. 35 // with given |page_id|, |url| and |transition_type|.
36 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, 36 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params,
37 int page_id, 37 int page_id,
38 const GURL& url, 38 const GURL& url,
39 content::PageTransition transition_type); 39 content::PageTransition transition_type);
40 40
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 // TODO(brettw) this should use a TestTabContents which should be generalized 167 // TODO(brettw) this should use a TestTabContents which should be generalized
168 // from the TabContents test. We will probably also need that class' version of 168 // from the TabContents test. We will probably also need that class' version of
169 // CreateRenderViewForRenderManager when more complicate tests start using this. 169 // CreateRenderViewForRenderManager when more complicate tests start using this.
170 class TestRenderViewHost : public RenderViewHost { 170 class TestRenderViewHost : public RenderViewHost {
171 public: 171 public:
172 // If the given TabContnets has a pending RVH, returns it, otherwise NULL. 172 // If the given TabContnets has a pending RVH, returns it, otherwise NULL.
173 static TestRenderViewHost* GetPendingForController( 173 static TestRenderViewHost* GetPendingForController(
174 content::NavigationController* controller); 174 content::NavigationController* controller);
175 175
176 TestRenderViewHost(SiteInstance* instance, 176 TestRenderViewHost(content::SiteInstance* instance,
177 content::RenderViewHostDelegate* delegate, 177 content::RenderViewHostDelegate* delegate,
178 int routing_id); 178 int routing_id);
179 virtual ~TestRenderViewHost(); 179 virtual ~TestRenderViewHost();
180 180
181 // Testing functions --------------------------------------------------------- 181 // Testing functions ---------------------------------------------------------
182 182
183 // Calls the RenderViewHosts' private OnMessageReceived function with the 183 // Calls the RenderViewHosts' private OnMessageReceived function with the
184 // given message. 184 // given message.
185 bool TestOnMessageReceived(const IPC::Message& msg); 185 bool TestOnMessageReceived(const IPC::Message& msg);
186 186
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // registered at a time, you can only have one of these objects at a time. 267 // registered at a time, you can only have one of these objects at a time.
268 class TestRenderViewHostFactory : public RenderViewHostFactory { 268 class TestRenderViewHostFactory : public RenderViewHostFactory {
269 public: 269 public:
270 explicit TestRenderViewHostFactory( 270 explicit TestRenderViewHostFactory(
271 content::RenderProcessHostFactory* rph_factory); 271 content::RenderProcessHostFactory* rph_factory);
272 virtual ~TestRenderViewHostFactory(); 272 virtual ~TestRenderViewHostFactory();
273 273
274 virtual void set_render_process_host_factory( 274 virtual void set_render_process_host_factory(
275 content::RenderProcessHostFactory* rph_factory); 275 content::RenderProcessHostFactory* rph_factory);
276 virtual RenderViewHost* CreateRenderViewHost( 276 virtual RenderViewHost* CreateRenderViewHost(
277 SiteInstance* instance, 277 content::SiteInstance* instance,
278 content::RenderViewHostDelegate* delegate, 278 content::RenderViewHostDelegate* delegate,
279 int routing_id, 279 int routing_id,
280 SessionStorageNamespace* session_storage) OVERRIDE; 280 SessionStorageNamespace* session_storage) OVERRIDE;
281 281
282 private: 282 private:
283 // This is a bit of a hack. With the current design of the site instances / 283 // This is a bit of a hack. With the current design of the site instances /
284 // browsing instances, it's difficult to pass a RenderProcessHostFactory 284 // browsing instances, it's difficult to pass a RenderProcessHostFactory
285 // around properly. 285 // around properly.
286 // 286 //
287 // Instead, we set it right before we create a new RenderViewHost, which 287 // Instead, we set it right before we create a new RenderViewHost, which
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 MockRenderProcessHostFactory rph_factory_; 340 MockRenderProcessHostFactory rph_factory_;
341 TestRenderViewHostFactory rvh_factory_; 341 TestRenderViewHostFactory rvh_factory_;
342 342
343 private: 343 private:
344 scoped_ptr<TestTabContents> contents_; 344 scoped_ptr<TestTabContents> contents_;
345 345
346 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); 346 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness);
347 }; 347 };
348 348
349 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_ 349 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_RENDER_VIEW_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698