Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: content/test/test_web_contents.cc

Issue 1002803002: Classify navigations without page id in parallel to the existing classifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 switches::kEnableBrowserSideNavigation)) { 60 switches::kEnableBrowserSideNavigation)) {
61 return static_cast<TestRenderFrameHost*>( 61 return static_cast<TestRenderFrameHost*>(
62 GetRenderManager()->speculative_render_frame_host_.get()); 62 GetRenderManager()->speculative_render_frame_host_.get());
63 } 63 }
64 return static_cast<TestRenderFrameHost*>( 64 return static_cast<TestRenderFrameHost*>(
65 GetRenderManager()->pending_frame_host()); 65 GetRenderManager()->pending_frame_host());
66 } 66 }
67 67
68 void TestWebContents::TestDidNavigate(RenderFrameHost* render_frame_host, 68 void TestWebContents::TestDidNavigate(RenderFrameHost* render_frame_host,
69 int page_id, 69 int page_id,
70 int nav_entry_id,
71 bool did_create_new_entry,
70 const GURL& url, 72 const GURL& url,
71 ui::PageTransition transition) { 73 ui::PageTransition transition) {
72 TestDidNavigateWithReferrer(render_frame_host, 74 TestDidNavigateWithReferrer(render_frame_host,
73 page_id, 75 page_id,
76 nav_entry_id,
77 did_create_new_entry,
74 url, 78 url,
75 Referrer(), 79 Referrer(),
76 transition); 80 transition);
77 } 81 }
78 82
79 void TestWebContents::TestDidNavigateWithReferrer( 83 void TestWebContents::TestDidNavigateWithReferrer(
80 RenderFrameHost* render_frame_host, 84 RenderFrameHost* render_frame_host,
81 int page_id, 85 int page_id,
86 int nav_entry_id,
87 bool did_create_new_entry,
82 const GURL& url, 88 const GURL& url,
83 const Referrer& referrer, 89 const Referrer& referrer,
84 ui::PageTransition transition) { 90 ui::PageTransition transition) {
85 FrameHostMsg_DidCommitProvisionalLoad_Params params; 91 FrameHostMsg_DidCommitProvisionalLoad_Params params;
86 92
87 params.page_id = page_id; 93 params.page_id = page_id;
94 params.nav_entry_id = nav_entry_id;
88 params.url = url; 95 params.url = url;
89 params.referrer = referrer; 96 params.referrer = referrer;
90 params.transition = transition; 97 params.transition = transition;
91 params.redirects = std::vector<GURL>(); 98 params.redirects = std::vector<GURL>();
92 params.should_update_history = false; 99 params.should_update_history = false;
93 params.searchable_form_url = GURL(); 100 params.searchable_form_url = GURL();
94 params.searchable_form_encoding = std::string(); 101 params.searchable_form_encoding = std::string();
102 params.did_create_new_entry = did_create_new_entry;
95 params.security_info = std::string(); 103 params.security_info = std::string();
96 params.gesture = NavigationGestureUser; 104 params.gesture = NavigationGestureUser;
97 params.was_within_same_page = false; 105 params.was_within_same_page = false;
98 params.is_post = false; 106 params.is_post = false;
99 params.page_state = PageState::CreateFromURL(url); 107 params.page_state = PageState::CreateFromURL(url);
100 108
101 RenderFrameHostImpl* rfhi = 109 RenderFrameHostImpl* rfhi =
102 static_cast<RenderFrameHostImpl*>(render_frame_host); 110 static_cast<RenderFrameHostImpl*>(render_frame_host);
103 rfhi->frame_tree_node()->navigator()->DidNavigate(rfhi, params); 111 rfhi->frame_tree_node()->navigator()->DidNavigate(rfhi, params);
104 } 112 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 TestRenderFrameHost* rfh = GetPendingMainFrame(); 183 TestRenderFrameHost* rfh = GetPendingMainFrame();
176 if (!rfh) 184 if (!rfh)
177 rfh = old_rfh; 185 rfh = old_rfh;
178 186
179 int page_id = entry->GetPageID(); 187 int page_id = entry->GetPageID();
180 if (page_id == -1) { 188 if (page_id == -1) {
181 // It's a new navigation, assign a never-seen page id to it. 189 // It's a new navigation, assign a never-seen page id to it.
182 page_id = GetMaxPageIDForSiteInstance(rfh->GetSiteInstance()) + 1; 190 page_id = GetMaxPageIDForSiteInstance(rfh->GetSiteInstance()) + 1;
183 } 191 }
184 192
185 rfh->SendNavigate(page_id, entry->GetURL()); 193 rfh->SendNavigate(page_id, entry->GetUniqueID(),
194 GetController().GetPendingEntryIndex() == -1,
Charlie Reis 2015/04/22 05:27:25 Interesting. This probably doesn't equal did_crea
Avi (use Gerrit) 2015/04/22 18:31:51 This whole thing is fakery for unit tests, and whi
195 entry->GetURL());
186 // Simulate the SwapOut_ACK. This is needed when cross-site navigation 196 // Simulate the SwapOut_ACK. This is needed when cross-site navigation
187 // happens. 197 // happens.
188 if (old_rfh != rfh) 198 if (old_rfh != rfh)
189 old_rfh->OnSwappedOut(); 199 old_rfh->OnSwappedOut();
190 } 200 }
191 201
192 void TestWebContents::ProceedWithCrossSiteNavigation() { 202 void TestWebContents::ProceedWithCrossSiteNavigation() {
193 if (!GetPendingMainFrame()) 203 if (!GetPendingMainFrame())
194 return; 204 return;
195 GetMainFrame()->SendBeforeUnloadACK(true); 205 GetMainFrame()->SendBeforeUnloadACK(true);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 279 }
270 280
271 void TestWebContents::ShowCreatedWidget(int route_id, 281 void TestWebContents::ShowCreatedWidget(int route_id,
272 const gfx::Rect& initial_rect) { 282 const gfx::Rect& initial_rect) {
273 } 283 }
274 284
275 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { 285 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) {
276 } 286 }
277 287
278 } // namespace content 288 } // namespace content
OLDNEW
« content/test/test_render_view_host.h ('K') | « content/test/test_web_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698