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

Side by Side Diff: chrome/browser/tab_contents/test_web_contents.h

Issue 18432: Factor out the test web contents from the WebContents unit test so that it ca... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
6 #define CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
7
8 #include "chrome/browser/tab_contents/web_contents.h"
9
10 class RenderViewHostFactory;
11 class TestRenderViewHost;
12
13 // Subclass WebContents to ensure it creates TestRenderViewHosts and does
14 // not do anything involving views.
15 class TestWebContents : public WebContents {
16 public:
17 // The render view host factory will be passed on to the
18 TestWebContents(Profile* profile, SiteInstance* instance,
19 RenderViewHostFactory* rvh_factory);
20
21 TestRenderViewHost* pending_rvh();
22
23 // State accessor.
24 bool cross_navigation_pending() {
25 return render_manager_.cross_navigation_pending_;
26 }
27
28 // Overrides WebContents::ShouldTransitionCrossSite so that we can test both
29 // alternatives without using command-line switches.
30 bool ShouldTransitionCrossSite() { return transition_cross_site; }
31
32 // Promote DidNavigate to public.
33 void TestDidNavigate(RenderViewHost* render_view_host,
34 const ViewHostMsg_FrameNavigate_Params& params) {
35 DidNavigate(render_view_host, params);
36 }
37
38 // Promote GetWebkitPrefs to public.
39 WebPreferences TestGetWebkitPrefs() {
40 return GetWebkitPrefs();
41 }
42
43 // Prevent interaction with views.
44 bool CreateRenderViewForRenderManager(RenderViewHost* render_view_host) {
45 // This will go to a TestRenderViewHost.
46 render_view_host->CreateRenderView();
47 return true;
48 }
49 void UpdateRenderViewSizeForRenderManager() {}
50
51 // Set by individual tests.
52 bool transition_cross_site;
53 };
54
55 #endif // CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/site_instance.cc ('k') | chrome/browser/tab_contents/test_web_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698