OLD | NEW |
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_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ |
6 #define CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "content/browser/tab_contents/tab_contents.h" | 9 #include "content/browser/tab_contents/tab_contents.h" |
10 #include "content/public/common/page_transition_types.h" | |
11 #include "webkit/glue/webpreferences.h" | 10 #include "webkit/glue/webpreferences.h" |
12 | 11 |
13 class TestRenderViewHost; | 12 class TestRenderViewHost; |
14 | 13 |
15 // Subclass TabContents to ensure it creates TestRenderViewHosts and does | 14 // Subclass TabContents to ensure it creates TestRenderViewHosts and does |
16 // not do anything involving views. | 15 // not do anything involving views. |
17 class TestTabContents : public TabContents { | 16 class TestTabContents : public TabContents { |
18 public: | 17 public: |
19 TestTabContents(content::BrowserContext* browser_context, | 18 TestTabContents(content::BrowserContext* browser_context, |
20 SiteInstance* instance); | 19 SiteInstance* instance); |
21 virtual ~TestTabContents(); | 20 virtual ~TestTabContents(); |
22 | 21 |
23 TestRenderViewHost* pending_rvh() const; | 22 TestRenderViewHost* pending_rvh() const; |
24 | 23 |
25 // State accessor. | 24 // State accessor. |
26 bool cross_navigation_pending() { | 25 bool cross_navigation_pending() { |
27 return render_manager_.cross_navigation_pending_; | 26 return render_manager_.cross_navigation_pending_; |
28 } | 27 } |
29 | 28 |
30 // Overrides TabContents::ShouldTransitionCrossSite so that we can test both | 29 // Overrides TabContents::ShouldTransitionCrossSite so that we can test both |
31 // alternatives without using command-line switches. | 30 // alternatives without using command-line switches. |
32 bool ShouldTransitionCrossSite() { return transition_cross_site; } | 31 bool ShouldTransitionCrossSite() { return transition_cross_site; } |
33 | 32 |
| 33 // Promote DidNavigate to public. |
34 void TestDidNavigate(RenderViewHost* render_view_host, | 34 void TestDidNavigate(RenderViewHost* render_view_host, |
35 int page_id, | 35 const ViewHostMsg_FrameNavigate_Params& params) { |
36 const GURL& url, | 36 DidNavigate(render_view_host, params); |
37 content::PageTransition transition); | 37 } |
38 void TestDidNavigateWithReferrer(RenderViewHost* render_view_host, | |
39 int page_id, | |
40 const GURL& url, | |
41 const content::Referrer& referrer, | |
42 content::PageTransition transition); | |
43 | 38 |
44 // Promote GetWebkitPrefs to public. | 39 // Promote GetWebkitPrefs to public. |
45 WebPreferences TestGetWebkitPrefs() { | 40 WebPreferences TestGetWebkitPrefs() { |
46 return GetWebkitPrefs(); | 41 return GetWebkitPrefs(); |
47 } | 42 } |
48 | 43 |
49 // Prevent interaction with views. | 44 // Prevent interaction with views. |
50 virtual bool CreateRenderViewForRenderManager( | 45 virtual bool CreateRenderViewForRenderManager( |
51 RenderViewHost* render_view_host) OVERRIDE; | 46 RenderViewHost* render_view_host) OVERRIDE; |
52 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE {} | 47 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE {} |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 91 |
97 // Expectations for arguments of |SetHistoryLengthAndPrune()|. | 92 // Expectations for arguments of |SetHistoryLengthAndPrune()|. |
98 bool expect_set_history_length_and_prune_; | 93 bool expect_set_history_length_and_prune_; |
99 scoped_refptr<const SiteInstance> | 94 scoped_refptr<const SiteInstance> |
100 expect_set_history_length_and_prune_site_instance_; | 95 expect_set_history_length_and_prune_site_instance_; |
101 int expect_set_history_length_and_prune_history_length_; | 96 int expect_set_history_length_and_prune_history_length_; |
102 int32 expect_set_history_length_and_prune_min_page_id_; | 97 int32 expect_set_history_length_and_prune_min_page_id_; |
103 }; | 98 }; |
104 | 99 |
105 #endif // CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ | 100 #endif // CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ |
OLD | NEW |