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 "webkit/glue/webpreferences.h" | 10 #include "webkit/glue/webpreferences.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 DidNavigate(render_view_host, params); | 35 DidNavigate(render_view_host, params); |
36 } | 36 } |
37 | 37 |
38 // Promote GetWebkitPrefs to public. | 38 // Promote GetWebkitPrefs to public. |
39 WebPreferences TestGetWebkitPrefs() { | 39 WebPreferences TestGetWebkitPrefs() { |
40 return GetWebkitPrefs(); | 40 return GetWebkitPrefs(); |
41 } | 41 } |
42 | 42 |
43 // Prevent interaction with views. | 43 // Prevent interaction with views. |
44 virtual bool CreateRenderViewForRenderManager( | 44 virtual bool CreateRenderViewForRenderManager( |
45 RenderViewHost* render_view_host); | 45 RenderViewHost* render_view_host) OVERRIDE; |
46 virtual void UpdateRenderViewSizeForRenderManager() {} | 46 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE {} |
47 | 47 |
48 // Returns a clone of this TestTabContents. The returned object is also a | 48 // Returns a clone of this TestTabContents. The returned object is also a |
49 // TestTabContents. The caller owns the returned object. | 49 // TestTabContents. The caller owns the returned object. |
50 virtual TabContents* Clone(); | 50 virtual TabContents* Clone() OVERRIDE; |
51 | 51 |
52 // Creates a pending navigation to the given URL with the default parameters | 52 // Creates a pending navigation to the given URL with the default parameters |
53 // and then commits the load with a page ID one larger than any seen. This | 53 // and then commits the load with a page ID one larger than any seen. This |
54 // emulates what happens on a new navigation. | 54 // emulates what happens on a new navigation. |
55 void NavigateAndCommit(const GURL& url); | 55 void NavigateAndCommit(const GURL& url); |
56 | 56 |
57 // Simulates the appropriate RenderView (pending if any, current otherwise) | 57 // Simulates the appropriate RenderView (pending if any, current otherwise) |
58 // sending a navigate notification for the NavigationController pending entry. | 58 // sending a navigate notification for the NavigationController pending entry. |
59 void CommitPendingNavigation(); | 59 void CommitPendingNavigation(); |
60 | 60 |
61 // Simulates the current RVH notifying that it has unloaded so that the | 61 // Simulates the current RVH notifying that it has unloaded so that the |
62 // pending RVH navigation can proceed. | 62 // pending RVH navigation can proceed. |
63 // Does nothing if no cross-navigation is pending. | 63 // Does nothing if no cross-navigation is pending. |
64 void ProceedWithCrossSiteNavigation(); | 64 void ProceedWithCrossSiteNavigation(); |
65 | 65 |
66 // Set by individual tests. | 66 // Set by individual tests. |
67 bool transition_cross_site; | 67 bool transition_cross_site; |
68 | 68 |
69 // Allow mocking of the RenderViewHostDelegate::View. | 69 // Allow mocking of the RenderViewHostDelegate::View. |
70 virtual RenderViewHostDelegate::View* GetViewDelegate(); | 70 virtual RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE; |
71 void set_view_delegate(RenderViewHostDelegate::View* view) { | 71 void set_view_delegate(RenderViewHostDelegate::View* view) { |
72 delegate_view_override_ = view; | 72 delegate_view_override_ = view; |
73 } | 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 |
74 private: | 88 private: |
75 RenderViewHostDelegate::View* delegate_view_override_; | 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 SiteInstance> |
| 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_; |
76 }; | 97 }; |
77 | 98 |
78 #endif // CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ | 99 #endif // CONTENT_BROWSER_TAB_CONTENTS_TEST_TAB_CONTENTS_H_ |
OLD | NEW |