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 #include "content/browser/tab_contents/test_tab_contents.h" | 5 #include "content/browser/tab_contents/test_tab_contents.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "content/browser/browser_url_handler_impl.h" | 9 #include "content/browser/browser_url_handler_impl.h" |
10 #include "content/browser/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 params.password_form = webkit::forms::PasswordForm(); | 76 params.password_form = webkit::forms::PasswordForm(); |
77 params.security_info = std::string(); | 77 params.security_info = std::string(); |
78 params.gesture = NavigationGestureUser; | 78 params.gesture = NavigationGestureUser; |
79 params.was_within_same_page = false; | 79 params.was_within_same_page = false; |
80 params.is_post = false; | 80 params.is_post = false; |
81 params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url)); | 81 params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url)); |
82 | 82 |
83 DidNavigate(render_view_host, params); | 83 DidNavigate(render_view_host, params); |
84 } | 84 } |
85 | 85 |
| 86 WebPreferences TestTabContents::TestGetWebkitPrefs() { |
| 87 return GetWebkitPrefs(); |
| 88 } |
| 89 |
86 bool TestTabContents::CreateRenderViewForRenderManager( | 90 bool TestTabContents::CreateRenderViewForRenderManager( |
87 RenderViewHost* render_view_host) { | 91 RenderViewHost* render_view_host) { |
88 // This will go to a TestRenderViewHost. | 92 // This will go to a TestRenderViewHost. |
89 static_cast<RenderViewHostImpl*>( | 93 static_cast<RenderViewHostImpl*>( |
90 render_view_host)->CreateRenderView(string16(), -1); | 94 render_view_host)->CreateRenderView(string16(), -1); |
91 return true; | 95 return true; |
92 } | 96 } |
93 | 97 |
94 WebContents* TestTabContents::Clone() { | 98 WebContents* TestTabContents::Clone() { |
95 TabContents* tc = new TestTabContents( | 99 TabContents* tc = new TestTabContents( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 page_id = GetMaxPageIDForSiteInstance(rvh->GetSiteInstance()) + 1; | 134 page_id = GetMaxPageIDForSiteInstance(rvh->GetSiteInstance()) + 1; |
131 } | 135 } |
132 rvh->SendNavigate(page_id, entry->GetURL()); | 136 rvh->SendNavigate(page_id, entry->GetURL()); |
133 | 137 |
134 // Simulate the SwapOut_ACK that fires if you commit a cross-site navigation | 138 // Simulate the SwapOut_ACK that fires if you commit a cross-site navigation |
135 // without making any network requests. | 139 // without making any network requests. |
136 if (old_rvh != rvh) | 140 if (old_rvh != rvh) |
137 static_cast<RenderViewHostImpl*>(old_rvh)->OnSwapOutACK(); | 141 static_cast<RenderViewHostImpl*>(old_rvh)->OnSwapOutACK(); |
138 } | 142 } |
139 | 143 |
| 144 int TestTabContents::GetNumberOfFocusCalls() { |
| 145 NOTREACHED(); |
| 146 return 0; |
| 147 } |
| 148 |
140 void TestTabContents::ProceedWithCrossSiteNavigation() { | 149 void TestTabContents::ProceedWithCrossSiteNavigation() { |
141 if (!pending_rvh()) | 150 if (!pending_rvh()) |
142 return; | 151 return; |
143 TestRenderViewHost* rvh = static_cast<TestRenderViewHost*>( | 152 TestRenderViewHost* rvh = static_cast<TestRenderViewHost*>( |
144 render_manager_.current_host()); | 153 render_manager_.current_host()); |
145 rvh->SendShouldCloseACK(true); | 154 rvh->SendShouldCloseACK(true); |
146 } | 155 } |
147 | 156 |
148 content::RenderViewHostDelegate::View* TestTabContents::GetViewDelegate() { | 157 content::RenderViewHostDelegate::View* TestTabContents::GetViewDelegate() { |
149 if (delegate_view_override_) | 158 if (delegate_view_override_) |
(...skipping 15 matching lines...) Expand all Loading... |
165 void TestTabContents::SetHistoryLengthAndPrune( | 174 void TestTabContents::SetHistoryLengthAndPrune( |
166 const SiteInstance* site_instance, int history_length, | 175 const SiteInstance* site_instance, int history_length, |
167 int32 min_page_id) { | 176 int32 min_page_id) { |
168 EXPECT_TRUE(expect_set_history_length_and_prune_); | 177 EXPECT_TRUE(expect_set_history_length_and_prune_); |
169 expect_set_history_length_and_prune_ = false; | 178 expect_set_history_length_and_prune_ = false; |
170 EXPECT_EQ(expect_set_history_length_and_prune_site_instance_, site_instance); | 179 EXPECT_EQ(expect_set_history_length_and_prune_site_instance_, site_instance); |
171 EXPECT_EQ(expect_set_history_length_and_prune_history_length_, | 180 EXPECT_EQ(expect_set_history_length_and_prune_history_length_, |
172 history_length); | 181 history_length); |
173 EXPECT_EQ(expect_set_history_length_and_prune_min_page_id_, min_page_id); | 182 EXPECT_EQ(expect_set_history_length_and_prune_min_page_id_, min_page_id); |
174 } | 183 } |
OLD | NEW |