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

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

Issue 2741313002: Renamed WasWithinSamePage to WasWithinSameDocument. (Closed)
Patch Set: Addressed review comments Created 3 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_render_frame_host.h" 5 #include "content/test/test_render_frame_host.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "content/browser/frame_host/frame_tree.h" 9 #include "content/browser/frame_host/frame_tree.h"
10 #include "content/browser/frame_host/navigation_handle_impl.h" 10 #include "content/browser/frame_host/navigation_handle_impl.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 params.http_status_code = 200; 162 params.http_status_code = 200;
163 params.socket_address.set_host("2001:db8::1"); 163 params.socket_address.set_host("2001:db8::1");
164 params.socket_address.set_port(80); 164 params.socket_address.set_port(80);
165 params.history_list_was_cleared = simulate_history_list_was_cleared_; 165 params.history_list_was_cleared = simulate_history_list_was_cleared_;
166 params.original_request_url = url; 166 params.original_request_url = url;
167 167
168 url::Replacements<char> replacements; 168 url::Replacements<char> replacements;
169 replacements.ClearRef(); 169 replacements.ClearRef();
170 170
171 // This approach to determining whether a navigation is to be treated as 171 // This approach to determining whether a navigation is to be treated as
172 // same page is not robust, as it will not handle pushState type navigation. 172 // same document is not robust, as it will not handle pushState type
173 // Do not use elsewhere! 173 // navigation. Do not use elsewhere!
174 params.was_within_same_page = 174 params.was_within_same_document =
175 (GetLastCommittedURL().is_valid() && !last_commit_was_error_page_ && 175 (GetLastCommittedURL().is_valid() && !last_commit_was_error_page_ &&
176 url.ReplaceComponents(replacements) == 176 url.ReplaceComponents(replacements) ==
177 GetLastCommittedURL().ReplaceComponents(replacements)); 177 GetLastCommittedURL().ReplaceComponents(replacements));
178 178
179 params.page_state = PageState::CreateForTesting(url, false, nullptr, nullptr); 179 params.page_state = PageState::CreateForTesting(url, false, nullptr, nullptr);
180 180
181 SendNavigateWithParams(&params); 181 SendNavigateWithParams(&params);
182 } 182 }
183 183
184 void TestRenderFrameHost::SimulateNavigationError(const GURL& url, 184 void TestRenderFrameHost::SimulateNavigationError(const GURL& url,
(...skipping 30 matching lines...) Expand all
215 CHECK(navigation_handle()); 215 CHECK(navigation_handle());
216 GURL error_url = GURL(kUnreachableWebDataURL); 216 GURL error_url = GURL(kUnreachableWebDataURL);
217 OnDidStartProvisionalLoad(error_url, std::vector<GURL>(), 217 OnDidStartProvisionalLoad(error_url, std::vector<GURL>(),
218 base::TimeTicks::Now()); 218 base::TimeTicks::Now());
219 FrameHostMsg_DidCommitProvisionalLoad_Params params; 219 FrameHostMsg_DidCommitProvisionalLoad_Params params;
220 params.nav_entry_id = 0; 220 params.nav_entry_id = 0;
221 params.did_create_new_entry = true; 221 params.did_create_new_entry = true;
222 params.url = navigation_handle()->GetURL(); 222 params.url = navigation_handle()->GetURL();
223 params.transition = GetParent() ? ui::PAGE_TRANSITION_MANUAL_SUBFRAME 223 params.transition = GetParent() ? ui::PAGE_TRANSITION_MANUAL_SUBFRAME
224 : ui::PAGE_TRANSITION_LINK; 224 : ui::PAGE_TRANSITION_LINK;
225 params.was_within_same_page = false; 225 params.was_within_same_document = false;
226 params.url_is_unreachable = true; 226 params.url_is_unreachable = true;
227 params.page_state = PageState::CreateForTesting(navigation_handle()->GetURL(), 227 params.page_state = PageState::CreateForTesting(navigation_handle()->GetURL(),
228 false, nullptr, nullptr); 228 false, nullptr, nullptr);
229 SendNavigateWithParams(&params); 229 SendNavigateWithParams(&params);
230 } 230 }
231 231
232 void TestRenderFrameHost::SimulateNavigationStop() { 232 void TestRenderFrameHost::SimulateNavigationStop() {
233 if (is_loading()) { 233 if (is_loading()) {
234 OnDidStopLoading(); 234 OnDidStopLoading();
235 } else if (IsBrowserSideNavigationEnabled()) { 235 } else if (IsBrowserSideNavigationEnabled()) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 // In most cases, the origin will match the URL's origin. Tests that need to 371 // In most cases, the origin will match the URL's origin. Tests that need to
372 // check corner cases (like about:blank) should specify the origin param 372 // check corner cases (like about:blank) should specify the origin param
373 // manually. 373 // manually.
374 url::Origin origin(url_copy); 374 url::Origin origin(url_copy);
375 params.origin = origin; 375 params.origin = origin;
376 376
377 url::Replacements<char> replacements; 377 url::Replacements<char> replacements;
378 replacements.ClearRef(); 378 replacements.ClearRef();
379 379
380 // This approach to determining whether a navigation is to be treated as 380 // This approach to determining whether a navigation is to be treated as
381 // same page is not robust, as it will not handle pushState type navigation. 381 // same document is not robust, as it will not handle pushState type
382 // Do not use elsewhere! 382 // navigation. Do not use elsewhere!
383 params.was_within_same_page = 383 params.was_within_same_document =
384 !ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_RELOAD) && 384 !ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_RELOAD) &&
385 !ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_TYPED) && 385 !ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_TYPED) &&
386 (GetLastCommittedURL().is_valid() && !last_commit_was_error_page_ && 386 (GetLastCommittedURL().is_valid() && !last_commit_was_error_page_ &&
387 url_copy.ReplaceComponents(replacements) == 387 url_copy.ReplaceComponents(replacements) ==
388 GetLastCommittedURL().ReplaceComponents(replacements)); 388 GetLastCommittedURL().ReplaceComponents(replacements));
389 389
390 params.page_state = 390 params.page_state =
391 PageState::CreateForTestingWithSequenceNumbers( 391 PageState::CreateForTestingWithSequenceNumbers(
392 url_copy, params.item_sequence_number, 392 url_copy, params.item_sequence_number,
393 params.document_sequence_number); 393 params.document_sequence_number);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at 518 // PlzNavigate: NavigationHandle::WillStartRequest has already been called at
519 // this point. 519 // this point.
520 if (!navigation_handle() || IsBrowserSideNavigationEnabled()) 520 if (!navigation_handle() || IsBrowserSideNavigationEnabled())
521 return; 521 return;
522 navigation_handle()->CallWillStartRequestForTesting( 522 navigation_handle()->CallWillStartRequestForTesting(
523 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault), 523 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault),
524 true /* user_gesture */, transition, false /* is_external_protocol */); 524 true /* user_gesture */, transition, false /* is_external_protocol */);
525 } 525 }
526 526
527 } // namespace content 527 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl_browsertest.cc ('k') | content/test/test_render_view_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698