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

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

Issue 7892007: Add ChromeRenderViewHostTestHarness to get rid of the dependency from RVHTH to profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_TEST_RENDER_VIEW_HOST_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_TEST_TEST_RENDER_VIEW_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_TEST_TEST_RENDER_VIEW_HOST_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_TEST_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/common/page_transition_types.h" 17 #include "content/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 {
21 class BrowserContext;
22 }
23
20 namespace gfx { 24 namespace gfx {
21 class Rect; 25 class Rect;
22 } 26 }
23 27
24 class NavigationController; 28 class NavigationController;
25 class SiteInstance; 29 class SiteInstance;
26 class TestingProfile;
27 class TestTabContents; 30 class TestTabContents;
28 struct WebMenuItem; 31 struct WebMenuItem;
29 struct ViewHostMsg_FrameNavigate_Params; 32 struct ViewHostMsg_FrameNavigate_Params;
30 33
31 // Utility function to initialize ViewHostMsg_NavigateParams_Params 34 // Utility function to initialize ViewHostMsg_NavigateParams_Params
32 // with given |page_id|, |url| and |transition_type|. 35 // with given |page_id|, |url| and |transition_type|.
33 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, 36 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params,
34 int page_id, 37 int page_id,
35 const GURL& url, 38 const GURL& url,
36 PageTransition::Type transition_type); 39 PageTransition::Type transition_type);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 class RenderViewHostTestHarness : public testing::Test { 288 class RenderViewHostTestHarness : public testing::Test {
286 public: 289 public:
287 RenderViewHostTestHarness(); 290 RenderViewHostTestHarness();
288 virtual ~RenderViewHostTestHarness(); 291 virtual ~RenderViewHostTestHarness();
289 292
290 NavigationController& controller(); 293 NavigationController& controller();
291 virtual TestTabContents* contents(); 294 virtual TestTabContents* contents();
292 TestRenderViewHost* rvh(); 295 TestRenderViewHost* rvh();
293 TestRenderViewHost* pending_rvh(); 296 TestRenderViewHost* pending_rvh();
294 TestRenderViewHost* active_rvh(); 297 TestRenderViewHost* active_rvh();
295 TestingProfile* profile(); 298 content::BrowserContext* browser_context();
296 MockRenderProcessHost* process(); 299 MockRenderProcessHost* process();
297 300
298 // Frees the current tab contents for tests that want to test destruction. 301 // Frees the current tab contents for tests that want to test destruction.
299 void DeleteContents(); 302 void DeleteContents();
300 303
301 // Sets the current tab contents for tests that want to alter it. Takes 304 // Sets the current tab contents for tests that want to alter it. Takes
302 // ownership of the TestTabContents passed. 305 // ownership of the TestTabContents passed.
303 virtual void SetContents(TestTabContents* contents); 306 virtual void SetContents(TestTabContents* contents);
304 307
305 // Creates a new TestTabContents. Ownership passes to the caller. 308 // Creates a new TestTabContents. Ownership passes to the caller.
306 TestTabContents* CreateTestTabContents(); 309 TestTabContents* CreateTestTabContents();
307 310
308 // Cover for |contents()->NavigateAndCommit(url)|. See 311 // Cover for |contents()->NavigateAndCommit(url)|. See
309 // TestTabContents::NavigateAndCommit for details. 312 // TestTabContents::NavigateAndCommit for details.
310 void NavigateAndCommit(const GURL& url); 313 void NavigateAndCommit(const GURL& url);
311 314
312 // Simulates a reload of the current page. 315 // Simulates a reload of the current page.
313 void Reload(); 316 void Reload();
314 317
315 protected: 318 protected:
316 // testing::Test 319 // testing::Test
317 virtual void SetUp(); 320 virtual void SetUp();
318 virtual void TearDown(); 321 virtual void TearDown();
319 322
320 // This profile will be created in SetUp if it has not already been created. 323 // This browser context will be created in SetUp if it has not already been
321 // This allows tests to override the profile if they so choose in their own 324 // created. This allows tests to override the browser context if they so
322 // SetUp function before calling the base class's (us) SetUp(). 325 // choose in their own SetUp function before calling the base class's (us)
323 scoped_ptr<TestingProfile> profile_; 326 // SetUp().
327 scoped_ptr<content::BrowserContext> browser_context_;
324 328
325 MessageLoopForUI message_loop_; 329 MessageLoopForUI message_loop_;
326 330
327 MockRenderProcessHostFactory rph_factory_; 331 MockRenderProcessHostFactory rph_factory_;
328 TestRenderViewHostFactory rvh_factory_; 332 TestRenderViewHostFactory rvh_factory_;
329 333
330 private: 334 private:
331 scoped_ptr<TestTabContents> contents_; 335 scoped_ptr<TestTabContents> contents_;
332 336
333 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); 337 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness);
334 }; 338 };
335 339
336 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_TEST_RENDER_VIEW_HOST_H_ 340 #endif // CONTENT_BROWSER_RENDERER_HOST_TEST_TEST_RENDER_VIEW_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/browser_context.h ('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