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

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_browsertest.cc

Issue 1867413002: Fix the replaceState-while-pending tests to check to see that the pending entry isn't affected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/frame_host/navigation_controller_impl.h" 5 #include "content/browser/frame_host/navigation_controller_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 2894 matching lines...) Expand 10 before | Expand all | Expand 10 after
2905 // Start with one page. 2905 // Start with one page.
2906 EXPECT_TRUE(NavigateToURL(shell, start_url)); 2906 EXPECT_TRUE(NavigateToURL(shell, start_url));
2907 2907
2908 // Have the user decide to go to a different page which is very slow. 2908 // Have the user decide to go to a different page which is very slow.
2909 NavigationStallDelegate stall_delegate(stalled_url); 2909 NavigationStallDelegate stall_delegate(stalled_url);
2910 ResourceDispatcherHost::Get()->SetDelegate(&stall_delegate); 2910 ResourceDispatcherHost::Get()->SetDelegate(&stall_delegate);
2911 controller.LoadURL( 2911 controller.LoadURL(
2912 stalled_url, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); 2912 stalled_url, Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
2913 2913
2914 // That should be the pending entry. 2914 // That should be the pending entry.
2915 NavigationEntryImpl* entry = controller.GetPendingEntry(); 2915 NavigationEntryImpl* original_pending_entry = controller.GetPendingEntry();
2916 ASSERT_NE(nullptr, entry); 2916 ASSERT_NE(nullptr, original_pending_entry);
2917 EXPECT_EQ(stalled_url, entry->GetURL()); 2917 EXPECT_EQ(stalled_url, original_pending_entry->GetURL());
2918 2918
2919 { 2919 {
2920 // Now the existing page uses history.replaceState(). 2920 // Now the existing page uses history.replaceState().
2921 FrameNavigateParamsCapturer capturer(root); 2921 FrameNavigateParamsCapturer capturer(root);
2922 capturer.set_wait_for_load(false); 2922 capturer.set_wait_for_load(false);
2923 std::string script = 2923 std::string script =
2924 "history.replaceState({}, '', '" + replace_state_filename + "')"; 2924 "history.replaceState({}, '', '" + replace_state_filename + "')";
2925 EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script)); 2925 EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script));
2926 capturer.Wait(); 2926 capturer.Wait();
2927 2927
2928 // The fact that there was a pending entry shouldn't interfere with the 2928 // The fact that there was a pending entry shouldn't interfere with the
2929 // classification. 2929 // classification.
2930 EXPECT_EQ(NAVIGATION_TYPE_EXISTING_PAGE, capturer.details().type); 2930 EXPECT_EQ(NAVIGATION_TYPE_EXISTING_PAGE, capturer.details().type);
2931 EXPECT_TRUE(capturer.details().is_in_page); 2931 EXPECT_TRUE(capturer.details().is_in_page);
2932
2933 // That should not have affected the pending entry.
2934 NavigationEntryImpl* pending_entry = controller.GetPendingEntry();
2935 EXPECT_EQ(original_pending_entry, pending_entry);
2932 } 2936 }
2933 2937
2934 ResourceDispatcherHost::Get()->SetDelegate(nullptr); 2938 ResourceDispatcherHost::Get()->SetDelegate(nullptr);
2935 } 2939 }
2936 2940
2937 } // namespace 2941 } // namespace
2938 2942
2939 IN_PROC_BROWSER_TEST_F( 2943 IN_PROC_BROWSER_TEST_F(
2940 NavigationControllerBrowserTest, 2944 NavigationControllerBrowserTest,
2941 NavigationTypeClassification_On1InPageToXWhile2Pending) { 2945 NavigationTypeClassification_On1InPageToXWhile2Pending) {
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
3514 observer.Wait(); 3518 observer.Wait();
3515 3519
3516 EXPECT_EQ(3, controller.GetEntryCount()); 3520 EXPECT_EQ(3, controller.GetEntryCount());
3517 EXPECT_EQ(3, RendererHistoryLength(shell())); 3521 EXPECT_EQ(3, RendererHistoryLength(shell()));
3518 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); 3522 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex());
3519 3523
3520 EXPECT_EQ(frame_url_1, frame->current_url()); 3524 EXPECT_EQ(frame_url_1, frame->current_url());
3521 } 3525 }
3522 3526
3523 } // namespace content 3527 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698