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

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

Issue 2225053002: Fix tests to behave properly with ISNs/DSNs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 "content/browser/frame_host/frame_tree.h" 8 #include "content/browser/frame_host/frame_tree.h"
9 #include "content/browser/frame_host/navigation_handle_impl.h" 9 #include "content/browser/frame_host/navigation_handle_impl.h"
10 #include "content/browser/frame_host/navigation_request.h" 10 #include "content/browser/frame_host/navigation_request.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 params.method = "GET"; 309 params.method = "GET";
310 params.http_status_code = response_code; 310 params.http_status_code = response_code;
311 params.socket_address.set_host("2001:db8::1"); 311 params.socket_address.set_host("2001:db8::1");
312 params.socket_address.set_port(80); 312 params.socket_address.set_port(80);
313 params.history_list_was_cleared = simulate_history_list_was_cleared_; 313 params.history_list_was_cleared = simulate_history_list_was_cleared_;
314 params.original_request_url = url_copy; 314 params.original_request_url = url_copy;
315 315
316 // Simulate Blink assigning an item sequence number to the navigation. 316 // Simulate Blink assigning an item sequence number to the navigation.
317 params.item_sequence_number = base::Time::Now().ToDoubleT() * 1000000; 317 params.item_sequence_number = base::Time::Now().ToDoubleT() * 1000000;
318 318
319 // When the user hits enter in the Omnibox without changing the URL, Blink
320 // behaves similarly to a reload and does not change the item and document
321 // sequence numbers. Simulate this behavior here too.
Charlie Reis 2016/08/08 21:27:11 Hmm. This won't be stale when we remove NAVIGATIO
nasko 2016/08/08 21:57:08 This is more or less relying on Blink keeping its
322 if (transition == ui::PAGE_TRANSITION_TYPED) {
323 const NavigationEntryImpl* entry =
324 static_cast<NavigationEntryImpl*>(frame_tree_node()
325 ->navigator()
326 ->GetController()
327 ->GetLastCommittedEntry());
328 if (entry && entry->GetURL() == url) {
329 FrameNavigationEntry* frame_entry =
330 entry->GetFrameEntry(frame_tree_node());
331 if (frame_entry) {
332 params.item_sequence_number = frame_entry->item_sequence_number();
333 params.document_sequence_number =
334 frame_entry->document_sequence_number();
335 }
336 }
337 }
338
319 // In most cases, the origin will match the URL's origin. Tests that need to 339 // In most cases, the origin will match the URL's origin. Tests that need to
320 // check corner cases (like about:blank) should specify the origin param 340 // check corner cases (like about:blank) should specify the origin param
321 // manually. 341 // manually.
322 url::Origin origin(url_copy); 342 url::Origin origin(url_copy);
323 params.origin = origin; 343 params.origin = origin;
324 344
325 url::Replacements<char> replacements; 345 url::Replacements<char> replacements;
326 replacements.ClearRef(); 346 replacements.ClearRef();
327 params.was_within_same_page = 347 params.was_within_same_page =
328 !ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_RELOAD) && 348 !ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_RELOAD) &&
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 void TestRenderFrameHost::SimulateWillStartRequest( 476 void TestRenderFrameHost::SimulateWillStartRequest(
457 ui::PageTransition transition) { 477 ui::PageTransition transition) {
458 if (!navigation_handle()) 478 if (!navigation_handle())
459 return; 479 return;
460 navigation_handle()->CallWillStartRequestForTesting( 480 navigation_handle()->CallWillStartRequestForTesting(
461 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault), 481 false /* is_post */, Referrer(GURL(), blink::WebReferrerPolicyDefault),
462 true /* user_gesture */, transition, false /* is_external_protocol */); 482 true /* user_gesture */, transition, false /* is_external_protocol */);
463 } 483 }
464 484
465 } // namespace content 485 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698