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

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

Issue 1907443006: PlzNavigate: store POST data in the FrameNavigationEntry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 7 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/browser/frame_host/render_frame_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 frame_entry->referrer(), *frame_entry, entry, navigate_type, 451 frame_entry->referrer(), *frame_entry, entry, navigate_type,
452 LOFI_UNSPECIFIED, false, base::TimeTicks::Now(), controller); 452 LOFI_UNSPECIFIED, false, base::TimeTicks::Now(), controller);
453 453
454 // Simulates request creation that triggers the 1st internal call to 454 // Simulates request creation that triggers the 1st internal call to
455 // GetFrameHostForNavigation. 455 // GetFrameHostForNavigation.
456 manager->DidCreateNavigationRequest(navigation_request.get()); 456 manager->DidCreateNavigationRequest(navigation_request.get());
457 457
458 // And also simulates the 2nd and final call to GetFrameHostForNavigation 458 // And also simulates the 2nd and final call to GetFrameHostForNavigation
459 // that determines the final frame that will commit the navigation. 459 // that determines the final frame that will commit the navigation.
460 TestRenderFrameHost* frame_host = static_cast<TestRenderFrameHost*>( 460 TestRenderFrameHost* frame_host = static_cast<TestRenderFrameHost*>(
461 manager->GetFrameHostForNavigation(*navigation_request)); 461 manager->GetFrameHostForNavigation(navigation_request.get(), true));
Charlie Reis 2016/05/11 23:58:53 Stale param, here and below.
clamy 2016/05/12 08:53:13 Done.
462 CHECK(frame_host); 462 CHECK(frame_host);
463 frame_host->set_pending_commit(true); 463 frame_host->set_pending_commit(true);
464 return frame_host; 464 return frame_host;
465 } 465 }
466 466
467 return manager->Navigate(frame_entry->url(), *frame_entry, entry); 467 return manager->Navigate(frame_entry->url(), *frame_entry, entry);
468 } 468 }
469 469
470 // Returns the pending RenderFrameHost. 470 // Returns the pending RenderFrameHost.
471 // PlzNavigate: returns the speculative RenderFrameHost. 471 // PlzNavigate: returns the speculative RenderFrameHost.
(...skipping 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 ASSERT_TRUE(host); 2874 ASSERT_TRUE(host);
2875 EXPECT_NE(host, initial_host); 2875 EXPECT_NE(host, initial_host);
2876 EXPECT_TRUE(host->IsRenderFrameLive()); 2876 EXPECT_TRUE(host->IsRenderFrameLive());
2877 WebUIImpl* web_ui = host->web_ui(); 2877 WebUIImpl* web_ui = host->web_ui();
2878 EXPECT_TRUE(web_ui); 2878 EXPECT_TRUE(web_ui);
2879 EXPECT_FALSE(host->pending_web_ui()); 2879 EXPECT_FALSE(host->pending_web_ui());
2880 EXPECT_FALSE(manager->GetNavigatingWebUI()); 2880 EXPECT_FALSE(manager->GetNavigatingWebUI());
2881 EXPECT_FALSE(GetPendingFrameHost(manager)); 2881 EXPECT_FALSE(GetPendingFrameHost(manager));
2882 2882
2883 // Prepare to commit, update the navigating RenderFrameHost. 2883 // Prepare to commit, update the navigating RenderFrameHost.
2884 EXPECT_EQ(host, manager->GetFrameHostForNavigation(*navigation_request)); 2884 EXPECT_EQ(host,
2885 manager->GetFrameHostForNavigation(navigation_request.get(), true));
2885 2886
2886 // There should be a pending WebUI set to reuse the current one. 2887 // There should be a pending WebUI set to reuse the current one.
2887 EXPECT_EQ(web_ui, host->web_ui()); 2888 EXPECT_EQ(web_ui, host->web_ui());
2888 EXPECT_EQ(web_ui, host->pending_web_ui()); 2889 EXPECT_EQ(web_ui, host->pending_web_ui());
2889 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI()); 2890 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI());
2890 2891
2891 // No pending RenderFrameHost as the current one should be reused. 2892 // No pending RenderFrameHost as the current one should be reused.
2892 EXPECT_FALSE(GetPendingFrameHost(manager)); 2893 EXPECT_FALSE(GetPendingFrameHost(manager));
2893 2894
2894 // The RenderFrameHost committed. 2895 // The RenderFrameHost committed.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2930 manager->DidCreateNavigationRequest(navigation_request.get()); 2931 manager->DidCreateNavigationRequest(navigation_request.get());
2931 2932
2932 // The current WebUI should still be in place and the pending WebUI should be 2933 // The current WebUI should still be in place and the pending WebUI should be
2933 // set to reuse it. 2934 // set to reuse it.
2934 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI()); 2935 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI());
2935 EXPECT_EQ(web_ui, host->web_ui()); 2936 EXPECT_EQ(web_ui, host->web_ui());
2936 EXPECT_EQ(web_ui, host->pending_web_ui()); 2937 EXPECT_EQ(web_ui, host->pending_web_ui());
2937 EXPECT_FALSE(GetPendingFrameHost(manager)); 2938 EXPECT_FALSE(GetPendingFrameHost(manager));
2938 2939
2939 // Prepare to commit, update the navigating RenderFrameHost. 2940 // Prepare to commit, update the navigating RenderFrameHost.
2940 EXPECT_EQ(host, manager->GetFrameHostForNavigation(*navigation_request)); 2941 EXPECT_EQ(host,
2942 manager->GetFrameHostForNavigation(navigation_request.get(), true));
2941 2943
2942 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI()); 2944 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI());
2943 EXPECT_EQ(web_ui, host->web_ui()); 2945 EXPECT_EQ(web_ui, host->web_ui());
2944 EXPECT_EQ(web_ui, host->pending_web_ui()); 2946 EXPECT_EQ(web_ui, host->pending_web_ui());
2945 EXPECT_FALSE(GetPendingFrameHost(manager)); 2947 EXPECT_FALSE(GetPendingFrameHost(manager));
2946 2948
2947 // The RenderFrameHost committed. 2949 // The RenderFrameHost committed.
2948 manager->DidNavigateFrame(host, true); 2950 manager->DidNavigateFrame(host, true);
2949 EXPECT_EQ(web_ui, host->web_ui()); 2951 EXPECT_EQ(web_ui, host->web_ui());
2950 EXPECT_FALSE(manager->GetNavigatingWebUI()); 2952 EXPECT_FALSE(manager->GetNavigatingWebUI());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2994 RenderFrameHostImpl* speculative_host = GetPendingFrameHost(manager); 2996 RenderFrameHostImpl* speculative_host = GetPendingFrameHost(manager);
2995 EXPECT_TRUE(speculative_host); 2997 EXPECT_TRUE(speculative_host);
2996 WebUIImpl* next_web_ui = manager->GetNavigatingWebUI(); 2998 WebUIImpl* next_web_ui = manager->GetNavigatingWebUI();
2997 EXPECT_TRUE(next_web_ui); 2999 EXPECT_TRUE(next_web_ui);
2998 EXPECT_EQ(next_web_ui, speculative_host->web_ui()); 3000 EXPECT_EQ(next_web_ui, speculative_host->web_ui());
2999 EXPECT_NE(next_web_ui, manager->current_frame_host()->web_ui()); 3001 EXPECT_NE(next_web_ui, manager->current_frame_host()->web_ui());
3000 EXPECT_FALSE(speculative_host->pending_web_ui()); 3002 EXPECT_FALSE(speculative_host->pending_web_ui());
3001 3003
3002 // Prepare to commit, update the navigating RenderFrameHost. 3004 // Prepare to commit, update the navigating RenderFrameHost.
3003 EXPECT_EQ(speculative_host, 3005 EXPECT_EQ(speculative_host,
3004 manager->GetFrameHostForNavigation(*navigation_request)); 3006 manager->GetFrameHostForNavigation(navigation_request.get(), true));
3005 3007
3006 EXPECT_TRUE(manager->current_frame_host()->web_ui()); 3008 EXPECT_TRUE(manager->current_frame_host()->web_ui());
3007 EXPECT_FALSE(manager->current_frame_host()->pending_web_ui()); 3009 EXPECT_FALSE(manager->current_frame_host()->pending_web_ui());
3008 EXPECT_EQ(speculative_host, GetPendingFrameHost(manager)); 3010 EXPECT_EQ(speculative_host, GetPendingFrameHost(manager));
3009 EXPECT_NE(next_web_ui, manager->current_frame_host()->web_ui()); 3011 EXPECT_NE(next_web_ui, manager->current_frame_host()->web_ui());
3010 EXPECT_EQ(next_web_ui, speculative_host->web_ui()); 3012 EXPECT_EQ(next_web_ui, speculative_host->web_ui());
3011 EXPECT_EQ(next_web_ui, manager->GetNavigatingWebUI()); 3013 EXPECT_EQ(next_web_ui, manager->GetNavigatingWebUI());
3012 EXPECT_FALSE(speculative_host->pending_web_ui()); 3014 EXPECT_FALSE(speculative_host->pending_web_ui());
3013 3015
3014 // The RenderFrameHost committed. 3016 // The RenderFrameHost committed.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3101 commit_params.should_enforce_strict_mixed_content_checking = false; 3103 commit_params.should_enforce_strict_mixed_content_checking = false;
3102 child_host->SendNavigateWithParams(&commit_params); 3104 child_host->SendNavigateWithParams(&commit_params);
3103 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC( 3105 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC(
3104 main_test_rfh(), false, proxy_to_parent->GetRoutingID())); 3106 main_test_rfh(), false, proxy_to_parent->GetRoutingID()));
3105 EXPECT_FALSE(root->child_at(0) 3107 EXPECT_FALSE(root->child_at(0)
3106 ->current_replication_state() 3108 ->current_replication_state()
3107 .should_enforce_strict_mixed_content_checking); 3109 .should_enforce_strict_mixed_content_checking);
3108 } 3110 }
3109 3111
3110 } // namespace content 3112 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698