OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_TEST_TEST_WEB_CONTENTS_H_ | 5 #ifndef CONTENT_TEST_TEST_WEB_CONTENTS_H_ |
6 #define CONTENT_TEST_TEST_WEB_CONTENTS_H_ | 6 #define CONTENT_TEST_TEST_WEB_CONTENTS_H_ |
7 | 7 |
8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
9 #include "content/public/common/page_transition_types.h" | 9 #include "content/public/common/page_transition_types.h" |
10 #include "content/public/test/web_contents_tester.h" | 10 #include "content/public/test/web_contents_tester.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 PageTransition transition) OVERRIDE; | 44 PageTransition transition) OVERRIDE; |
45 virtual WebPreferences TestGetWebkitPrefs() OVERRIDE; | 45 virtual WebPreferences TestGetWebkitPrefs() OVERRIDE; |
46 | 46 |
47 TestRenderViewHost* pending_test_rvh() const; | 47 TestRenderViewHost* pending_test_rvh() const; |
48 | 48 |
49 // State accessor. | 49 // State accessor. |
50 bool cross_navigation_pending() { | 50 bool cross_navigation_pending() { |
51 return GetRenderManager()->cross_navigation_pending_; | 51 return GetRenderManager()->cross_navigation_pending_; |
52 } | 52 } |
53 | 53 |
54 // Overrides WebContentsImpl::ShouldTransitionCrossSite so that we can test | |
55 // both alternatives without using command-line switches. | |
56 bool ShouldTransitionCrossSite() { return transition_cross_site; } | |
57 | |
58 // Prevent interaction with views. | 54 // Prevent interaction with views. |
59 virtual bool CreateRenderViewForRenderManager( | 55 virtual bool CreateRenderViewForRenderManager( |
60 RenderViewHost* render_view_host, | 56 RenderViewHost* render_view_host, |
61 int opener_route_id, | 57 int opener_route_id, |
62 int proxy_routing_id, | 58 int proxy_routing_id, |
63 bool for_main_frame) OVERRIDE; | 59 bool for_main_frame) OVERRIDE; |
64 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE {} | 60 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE {} |
65 | 61 |
66 // Returns a clone of this TestWebContents. The returned object is also a | 62 // Returns a clone of this TestWebContents. The returned object is also a |
67 // TestWebContents. The caller owns the returned object. | 63 // TestWebContents. The caller owns the returned object. |
68 virtual WebContents* Clone() OVERRIDE; | 64 virtual WebContents* Clone() OVERRIDE; |
69 | 65 |
70 // Set by individual tests. | |
71 bool transition_cross_site; | |
72 | |
73 // Allow mocking of the RenderViewHostDelegateView. | 66 // Allow mocking of the RenderViewHostDelegateView. |
74 virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE; | 67 virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE; |
75 void set_delegate_view(RenderViewHostDelegateView* view) { | 68 void set_delegate_view(RenderViewHostDelegateView* view) { |
76 delegate_view_override_ = view; | 69 delegate_view_override_ = view; |
77 } | 70 } |
78 | 71 |
79 // Allows us to simulate this tab having an opener. | 72 // Allows us to simulate this tab having an opener. |
80 void SetOpener(TestWebContents* opener); | 73 void SetOpener(TestWebContents* opener); |
81 | 74 |
82 // Allows us to simulate that a contents was created via CreateNewWindow. | 75 // Allows us to simulate that a contents was created via CreateNewWindow. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 bool expect_set_history_length_and_prune_; | 125 bool expect_set_history_length_and_prune_; |
133 scoped_refptr<const SiteInstanceImpl> | 126 scoped_refptr<const SiteInstanceImpl> |
134 expect_set_history_length_and_prune_site_instance_; | 127 expect_set_history_length_and_prune_site_instance_; |
135 int expect_set_history_length_and_prune_history_length_; | 128 int expect_set_history_length_and_prune_history_length_; |
136 int32 expect_set_history_length_and_prune_min_page_id_; | 129 int32 expect_set_history_length_and_prune_min_page_id_; |
137 }; | 130 }; |
138 | 131 |
139 } // namespace content | 132 } // namespace content |
140 | 133 |
141 #endif // CONTENT_TEST_TEST_WEB_CONTENTS_H_ | 134 #endif // CONTENT_TEST_TEST_WEB_CONTENTS_H_ |
OLD | NEW |