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

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

Issue 2584513003: PlzNavigate: identify same-page browser-initiated navigation. (Closed)
Patch Set: Rebase. Created 3 years, 10 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
« no previous file with comments | « content/test/test_web_contents.h ('k') | ios/web/navigation/navigation_manager_impl.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/browser_url_handler_impl.h" 9 #include "content/browser/browser_url_handler_impl.h"
10 #include "content/browser/frame_host/cross_process_frame_connector.h" 10 #include "content/browser/frame_host/cross_process_frame_connector.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 transition); 109 transition);
110 } 110 }
111 111
112 void TestWebContents::TestDidNavigateWithReferrer( 112 void TestWebContents::TestDidNavigateWithReferrer(
113 RenderFrameHost* render_frame_host, 113 RenderFrameHost* render_frame_host,
114 int nav_entry_id, 114 int nav_entry_id,
115 bool did_create_new_entry, 115 bool did_create_new_entry,
116 const GURL& url, 116 const GURL& url,
117 const Referrer& referrer, 117 const Referrer& referrer,
118 ui::PageTransition transition) { 118 ui::PageTransition transition) {
119 TestDidNavigateWithSequenceNumber(render_frame_host, nav_entry_id,
120 did_create_new_entry, url, referrer,
121 transition, false, -1, -1);
122 }
123
124 void TestWebContents::TestDidNavigateWithSequenceNumber(
125 RenderFrameHost* render_frame_host,
126 int nav_entry_id,
127 bool did_create_new_entry,
128 const GURL& url,
129 const Referrer& referrer,
130 ui::PageTransition transition,
131 bool was_within_same_page,
132 int item_sequence_number,
133 int document_sequence_number) {
119 TestRenderFrameHost* rfh = 134 TestRenderFrameHost* rfh =
120 static_cast<TestRenderFrameHost*>(render_frame_host); 135 static_cast<TestRenderFrameHost*>(render_frame_host);
121 rfh->InitializeRenderFrameIfNeeded(); 136 rfh->InitializeRenderFrameIfNeeded();
122 137
123 if (!rfh->is_loading()) 138 if (!rfh->is_loading())
124 rfh->SimulateNavigationStart(url); 139 rfh->SimulateNavigationStart(url);
125 140
126 FrameHostMsg_DidCommitProvisionalLoad_Params params; 141 FrameHostMsg_DidCommitProvisionalLoad_Params params;
127 142
128 params.nav_entry_id = nav_entry_id; 143 params.nav_entry_id = nav_entry_id;
144 params.frame_unique_name = std::string();
145 params.item_sequence_number = item_sequence_number;
146 params.document_sequence_number = document_sequence_number;
129 params.url = url; 147 params.url = url;
148 params.base_url = GURL();
130 params.referrer = referrer; 149 params.referrer = referrer;
131 params.transition = transition; 150 params.transition = transition;
132 params.redirects = std::vector<GURL>(); 151 params.redirects = std::vector<GURL>();
133 params.should_update_history = false; 152 params.should_update_history = true;
153 params.contents_mime_type = std::string("text/html");
154 params.socket_address = net::HostPortPair();
155 params.intended_as_new_entry = did_create_new_entry;
156 params.did_create_new_entry = did_create_new_entry;
157 params.should_replace_current_entry = false;
158 params.gesture = NavigationGestureUser;
159 params.method = "GET";
160 params.post_id = 0;
161 params.was_within_same_page = was_within_same_page;
162 params.http_status_code = 200;
163 params.url_is_unreachable = false;
164 if (item_sequence_number != -1 && document_sequence_number != -1) {
165 params.page_state = PageState::CreateForTestingWithSequenceNumbers(
166 url, item_sequence_number, document_sequence_number);
167 } else {
168 params.page_state = PageState::CreateFromURL(url);
169 }
170 params.original_request_url = GURL();
171 params.is_overriding_user_agent = false;
172 params.history_list_was_cleared = false;
173 params.render_view_routing_id = 0;
174 params.origin = url::Origin();
175 params.report_type = FrameMsg_UILoadMetricsReportType::NO_REPORT;
176 params.ui_timestamp = base::TimeTicks();
177 params.insecure_request_policy = blink::kLeaveInsecureRequestsAlone;
178 params.has_potentially_trustworthy_unique_origin = false;
134 params.searchable_form_url = GURL(); 179 params.searchable_form_url = GURL();
135 params.searchable_form_encoding = std::string(); 180 params.searchable_form_encoding = std::string();
136 params.did_create_new_entry = did_create_new_entry;
137 params.gesture = NavigationGestureUser;
138 params.was_within_same_page = false;
139 params.method = "GET";
140 params.page_state = PageState::CreateFromURL(url);
141 params.contents_mime_type = std::string("text/html");
142 181
143 rfh->SendNavigateWithParams(&params); 182 rfh->SendNavigateWithParams(&params);
144 } 183 }
145 184
146 const std::string& TestWebContents::GetSaveFrameHeaders() { 185 const std::string& TestWebContents::GetSaveFrameHeaders() {
147 return save_frame_headers_; 186 return save_frame_headers_;
148 } 187 }
149 188
150 bool TestWebContents::CrossProcessNavigationPending() { 189 bool TestWebContents::CrossProcessNavigationPending() {
151 if (IsBrowserSideNavigationEnabled()) { 190 if (IsBrowserSideNavigationEnabled()) {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 int route_id) { 380 int route_id) {
342 } 381 }
343 382
344 void TestWebContents::SaveFrameWithHeaders(const GURL& url, 383 void TestWebContents::SaveFrameWithHeaders(const GURL& url,
345 const Referrer& referrer, 384 const Referrer& referrer,
346 const std::string& headers) { 385 const std::string& headers) {
347 save_frame_headers_ = headers; 386 save_frame_headers_ = headers;
348 } 387 }
349 388
350 } // namespace content 389 } // namespace content
OLDNEW
« no previous file with comments | « content/test/test_web_contents.h ('k') | ios/web/navigation/navigation_manager_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698