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/web_contents/test_web_contents.h" | 5 #include "content/browser/web_contents/test_web_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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 GURL loaded_url(url); | 108 GURL loaded_url(url); |
109 bool reverse_on_redirect = false; | 109 bool reverse_on_redirect = false; |
110 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( | 110 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( |
111 &loaded_url, GetBrowserContext(), &reverse_on_redirect); | 111 &loaded_url, GetBrowserContext(), &reverse_on_redirect); |
112 | 112 |
113 // LoadURL created a navigation entry, now simulate the RenderView sending | 113 // LoadURL created a navigation entry, now simulate the RenderView sending |
114 // a notification that it actually navigated. | 114 // a notification that it actually navigated. |
115 CommitPendingNavigation(); | 115 CommitPendingNavigation(); |
116 } | 116 } |
117 | 117 |
| 118 void TestWebContents::TestSetIsLoading(bool value) { |
| 119 SetIsLoading(value, NULL); |
| 120 } |
| 121 |
118 void TestWebContents::CommitPendingNavigation() { | 122 void TestWebContents::CommitPendingNavigation() { |
119 // If we are doing a cross-site navigation, this simulates the current RVH | 123 // If we are doing a cross-site navigation, this simulates the current RVH |
120 // notifying that it has unloaded so the pending RVH is resumed and can | 124 // notifying that it has unloaded so the pending RVH is resumed and can |
121 // navigate. | 125 // navigate. |
122 ProceedWithCrossSiteNavigation(); | 126 ProceedWithCrossSiteNavigation(); |
123 RenderViewHost* old_rvh = render_manager_.current_host(); | 127 RenderViewHost* old_rvh = render_manager_.current_host(); |
124 TestRenderViewHost* rvh = | 128 TestRenderViewHost* rvh = |
125 static_cast<TestRenderViewHost*>(GetPendingRenderViewHost()); | 129 static_cast<TestRenderViewHost*>(GetPendingRenderViewHost()); |
126 if (!rvh) | 130 if (!rvh) |
127 rvh = static_cast<TestRenderViewHost*>(old_rvh); | 131 rvh = static_cast<TestRenderViewHost*>(old_rvh); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 int32 min_page_id) { | 188 int32 min_page_id) { |
185 EXPECT_TRUE(expect_set_history_length_and_prune_); | 189 EXPECT_TRUE(expect_set_history_length_and_prune_); |
186 expect_set_history_length_and_prune_ = false; | 190 expect_set_history_length_and_prune_ = false; |
187 EXPECT_EQ(expect_set_history_length_and_prune_site_instance_, site_instance); | 191 EXPECT_EQ(expect_set_history_length_and_prune_site_instance_, site_instance); |
188 EXPECT_EQ(expect_set_history_length_and_prune_history_length_, | 192 EXPECT_EQ(expect_set_history_length_and_prune_history_length_, |
189 history_length); | 193 history_length); |
190 EXPECT_EQ(expect_set_history_length_and_prune_min_page_id_, min_page_id); | 194 EXPECT_EQ(expect_set_history_length_and_prune_min_page_id_, min_page_id); |
191 } | 195 } |
192 | 196 |
193 } // namespace content | 197 } // namespace content |
OLD | NEW |