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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // navigate. | 151 // navigate. |
152 // PlzNavigate: the pending RFH is not created before the navigation commit, | 152 // 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 | 153 // so it is necessary to simulate the IO thread response here to commit in the |
154 // proper renderer. It is necessary to call PrepareForCommit before getting | 154 // proper renderer. It is necessary to call PrepareForCommit before getting |
155 // the main and the pending frame because when we are trying to navigate to a | 155 // the main and the pending frame because when we are trying to navigate to a |
156 // webui from a new tab, a RenderFrameHost is created to display it that is | 156 // webui from a new tab, a RenderFrameHost is created to display it that is |
157 // committed immediately (since it is a new tab). Therefore the main frame is | 157 // committed immediately (since it is a new tab). Therefore the main frame is |
158 // replaced without a pending frame being created, and we don't get the right | 158 // replaced without a pending frame being created, and we don't get the right |
159 // values for the RFH to navigate: we try to use the old one that has been | 159 // values for the RFH to navigate: we try to use the old one that has been |
160 // deleted in the meantime. | 160 // deleted in the meantime. |
161 GetMainFrame()->PrepareForCommit(entry->GetURL()); | 161 GetMainFrame()->PrepareForCommit(); |
162 | 162 |
163 TestRenderFrameHost* old_rfh = GetMainFrame(); | 163 TestRenderFrameHost* old_rfh = GetMainFrame(); |
164 TestRenderFrameHost* rfh = GetPendingMainFrame(); | 164 TestRenderFrameHost* rfh = GetPendingMainFrame(); |
165 if (!rfh) | 165 if (!rfh) |
166 rfh = old_rfh; | 166 rfh = old_rfh; |
167 | 167 |
168 int page_id = entry->GetPageID(); | 168 int page_id = entry->GetPageID(); |
169 if (page_id == -1) { | 169 if (page_id == -1) { |
170 // It's a new navigation, assign a never-seen page id to it. | 170 // It's a new navigation, assign a never-seen page id to it. |
171 page_id = GetMaxPageIDForSiteInstance(rfh->GetSiteInstance()) + 1; | 171 page_id = GetMaxPageIDForSiteInstance(rfh->GetSiteInstance()) + 1; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 } | 258 } |
259 | 259 |
260 void TestWebContents::ShowCreatedWidget(int route_id, | 260 void TestWebContents::ShowCreatedWidget(int route_id, |
261 const gfx::Rect& initial_rect) { | 261 const gfx::Rect& initial_rect) { |
262 } | 262 } |
263 | 263 |
264 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { | 264 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { |
265 } | 265 } |
266 | 266 |
267 } // namespace content | 267 } // namespace content |
OLD | NEW |