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

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

Issue 10024066: TabContents -> WebContentsImpl, part 4. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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) 2012 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 CONTENT_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
6 #define CONTENT_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
7 #pragma once
8
9 #include "content/browser/tab_contents/tab_contents.h"
10 #include "content/public/common/page_transition_types.h"
11 #include "content/test/web_contents_tester.h"
12 #include "webkit/glue/webpreferences.h"
13
14 class SiteInstanceImpl;
15
16 namespace content {
17
18 class RenderViewHost;
19 class TestRenderViewHost;
20 class WebContentsTester;
21
22 // Subclass TabContents to ensure it creates TestRenderViewHosts
23 // and does not do anything involving views.
24 class TestWebContents : public TabContents, public WebContentsTester {
25 public:
26 TestWebContents(BrowserContext* browser_context, SiteInstance* instance);
27 virtual ~TestWebContents();
28
29 // WebContentsTester implementation.
30 virtual void CommitPendingNavigation() OVERRIDE;
31 virtual int GetNumberOfFocusCalls() OVERRIDE;
32 virtual RenderViewHost* GetPendingRenderViewHost() const OVERRIDE;
33 virtual void NavigateAndCommit(const GURL& url) OVERRIDE;
34 virtual void ProceedWithCrossSiteNavigation() OVERRIDE;
35 virtual void TestDidNavigate(RenderViewHost* render_view_host,
36 int page_id,
37 const GURL& url,
38 PageTransition transition) OVERRIDE;
39 virtual void TestDidNavigateWithReferrer(RenderViewHost* render_view_host,
40 int page_id,
41 const GURL& url,
42 const Referrer& referrer,
43 PageTransition transition) OVERRIDE;
44 virtual WebPreferences TestGetWebkitPrefs() OVERRIDE;
45
46 TestRenderViewHost* pending_test_rvh() const;
47
48 // State accessor.
49 bool cross_navigation_pending() {
50 return render_manager_.cross_navigation_pending_;
51 }
52
53 // Overrides TabContents::ShouldTransitionCrossSite so that we can test both
54 // alternatives without using command-line switches.
55 bool ShouldTransitionCrossSite() { return transition_cross_site; }
56
57 // Prevent interaction with views.
58 virtual bool CreateRenderViewForRenderManager(
59 RenderViewHost* render_view_host) OVERRIDE;
60 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE {}
61
62 // Returns a clone of this TestWebContents. The returned object is also a
63 // TestWebContents. The caller owns the returned object.
64 virtual WebContents* Clone() OVERRIDE;
65
66 // Set by individual tests.
67 bool transition_cross_site;
68
69 // Allow mocking of the RenderViewHostDelegate::View.
70 virtual RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE;
71 void set_view_delegate(RenderViewHostDelegate::View* view) {
72 delegate_view_override_ = view;
73 }
74
75 // Establish expected arguments for |SetHistoryLengthAndPrune()|. When
76 // |SetHistoryLengthAndPrune()| is called, the arguments are compared
77 // with the expected arguments specified here.
78 void ExpectSetHistoryLengthAndPrune(const SiteInstance* site_instance,
79 int history_length,
80 int32 min_page_id);
81
82 // Compares the arguments passed in with the expected arguments passed in
83 // to |ExpectSetHistoryLengthAndPrune()|.
84 virtual void SetHistoryLengthAndPrune(const SiteInstance* site_instance,
85 int history_length,
86 int32 min_page_id) OVERRIDE;
87
88 private:
89 RenderViewHostDelegate::View* delegate_view_override_;
90
91 // Expectations for arguments of |SetHistoryLengthAndPrune()|.
92 bool expect_set_history_length_and_prune_;
93 scoped_refptr<const SiteInstanceImpl>
94 expect_set_history_length_and_prune_site_instance_;
95 int expect_set_history_length_and_prune_history_length_;
96 int32 expect_set_history_length_and_prune_min_page_id_;
97 };
98
99 } // namespace content
100
101 #endif // CONTENT_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
OLDNEW
« no previous file with comments | « content/browser/tab_contents/tab_contents_view_win.cc ('k') | content/browser/tab_contents/test_web_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698