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/test/test_web_contents.h" | 5 #include "content/test/test_web_contents.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "content/browser/browser_url_handler_impl.h" | 10 #include "content/browser/browser_url_handler_impl.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 // LoadURL created a navigation entry, now simulate the RenderView sending | 134 // LoadURL created a navigation entry, now simulate the RenderView sending |
135 // a notification that it actually navigated. | 135 // a notification that it actually navigated. |
136 CommitPendingNavigation(); | 136 CommitPendingNavigation(); |
137 } | 137 } |
138 | 138 |
139 void TestWebContents::TestSetIsLoading(bool value) { | 139 void TestWebContents::TestSetIsLoading(bool value) { |
140 SetIsLoading(GetRenderViewHost(), value, true, NULL); | 140 SetIsLoading(GetRenderViewHost(), value, true, NULL); |
141 } | 141 } |
142 | 142 |
143 void TestWebContents::CommitPendingNavigation() { | 143 void TestWebContents::CommitPendingNavigation() { |
144 const NavigationEntry* entry = GetController().GetPendingEntry(); | |
145 DCHECK(entry); | |
146 | |
144 // If we are doing a cross-site navigation, this simulates the current RFH | 147 // If we are doing a cross-site navigation, this simulates the current RFH |
145 // notifying that it has unloaded so the pending RFH is resumed and can | 148 // notifying that it has unloaded so the pending RFH is resumed and can |
146 // navigate. | 149 // navigate. |
147 TestRenderFrameHost* old_rfh = GetMainFrame(); | |
148 const NavigationEntry* entry = GetController().GetPendingEntry(); | |
149 DCHECK(entry); | |
150 | |
151 // Simulate the BeforeUnload ACK if necessary. | |
152 // PlzNavigate: the pending RFH is not created before the navigation commit, | 150 // PlzNavigate: the pending RFH is not created before the navigation commit, |
153 // so it is necessary to simulate the IO thread response here to commit in the | 151 // so it is necessary to simulate the IO thread response here to commit in the |
154 // proper renderer. | 152 // proper renderer. |
155 old_rfh->PrepareForCommit(entry->GetURL()); | 153 GetMainFrame()->PrepareForCommit(entry->GetURL()); |
clamy
2015/01/13 12:41:59
There is exactly the same problem of the webui RFH
nasko
2015/01/17 00:22:01
Acknowledged.
| |
156 | 154 |
155 TestRenderFrameHost* old_rfh = GetMainFrame(); | |
157 TestRenderFrameHost* rfh = GetPendingMainFrame(); | 156 TestRenderFrameHost* rfh = GetPendingMainFrame(); |
158 if (!rfh) | 157 if (!rfh) |
159 rfh = old_rfh; | 158 rfh = old_rfh; |
160 | 159 |
161 int page_id = entry->GetPageID(); | 160 int page_id = entry->GetPageID(); |
162 if (page_id == -1) { | 161 if (page_id == -1) { |
163 // It's a new navigation, assign a never-seen page id to it. | 162 // It's a new navigation, assign a never-seen page id to it. |
164 page_id = GetMaxPageIDForSiteInstance(rfh->GetSiteInstance()) + 1; | 163 page_id = GetMaxPageIDForSiteInstance(rfh->GetSiteInstance()) + 1; |
165 } | 164 } |
166 | 165 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 } | 250 } |
252 | 251 |
253 void TestWebContents::ShowCreatedWidget(int route_id, | 252 void TestWebContents::ShowCreatedWidget(int route_id, |
254 const gfx::Rect& initial_pos) { | 253 const gfx::Rect& initial_pos) { |
255 } | 254 } |
256 | 255 |
257 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { | 256 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { |
258 } | 257 } |
259 | 258 |
260 } // namespace content | 259 } // namespace content |
OLD | NEW |