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

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

Issue 2002633002: PlzNavigate: fix issue preventing navigations to WebUIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Getting the StoragePartition from NavigationRequest 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()));
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 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2868 ASSERT_TRUE(host); 2868 ASSERT_TRUE(host);
2869 EXPECT_NE(host, initial_host); 2869 EXPECT_NE(host, initial_host);
2870 EXPECT_TRUE(host->IsRenderFrameLive()); 2870 EXPECT_TRUE(host->IsRenderFrameLive());
2871 WebUIImpl* web_ui = host->web_ui(); 2871 WebUIImpl* web_ui = host->web_ui();
2872 EXPECT_TRUE(web_ui); 2872 EXPECT_TRUE(web_ui);
2873 EXPECT_FALSE(host->pending_web_ui()); 2873 EXPECT_FALSE(host->pending_web_ui());
2874 EXPECT_FALSE(manager->GetNavigatingWebUI()); 2874 EXPECT_FALSE(manager->GetNavigatingWebUI());
2875 EXPECT_FALSE(GetPendingFrameHost(manager)); 2875 EXPECT_FALSE(GetPendingFrameHost(manager));
2876 2876
2877 // Prepare to commit, update the navigating RenderFrameHost. 2877 // Prepare to commit, update the navigating RenderFrameHost.
2878 EXPECT_EQ(host, manager->GetFrameHostForNavigation(*navigation_request)); 2878 EXPECT_EQ(host, manager->GetFrameHostForNavigation(navigation_request.get()));
2879 2879
2880 // There should be a pending WebUI set to reuse the current one. 2880 // There should be a pending WebUI set to reuse the current one.
2881 EXPECT_EQ(web_ui, host->web_ui()); 2881 EXPECT_EQ(web_ui, host->web_ui());
2882 EXPECT_EQ(web_ui, host->pending_web_ui()); 2882 EXPECT_EQ(web_ui, host->pending_web_ui());
2883 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI()); 2883 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI());
2884 2884
2885 // No pending RenderFrameHost as the current one should be reused. 2885 // No pending RenderFrameHost as the current one should be reused.
2886 EXPECT_FALSE(GetPendingFrameHost(manager)); 2886 EXPECT_FALSE(GetPendingFrameHost(manager));
2887 2887
2888 // The RenderFrameHost committed. 2888 // The RenderFrameHost committed.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2924 manager->DidCreateNavigationRequest(navigation_request.get()); 2924 manager->DidCreateNavigationRequest(navigation_request.get());
2925 2925
2926 // The current WebUI should still be in place and the pending WebUI should be 2926 // The current WebUI should still be in place and the pending WebUI should be
2927 // set to reuse it. 2927 // set to reuse it.
2928 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI()); 2928 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI());
2929 EXPECT_EQ(web_ui, host->web_ui()); 2929 EXPECT_EQ(web_ui, host->web_ui());
2930 EXPECT_EQ(web_ui, host->pending_web_ui()); 2930 EXPECT_EQ(web_ui, host->pending_web_ui());
2931 EXPECT_FALSE(GetPendingFrameHost(manager)); 2931 EXPECT_FALSE(GetPendingFrameHost(manager));
2932 2932
2933 // Prepare to commit, update the navigating RenderFrameHost. 2933 // Prepare to commit, update the navigating RenderFrameHost.
2934 EXPECT_EQ(host, manager->GetFrameHostForNavigation(*navigation_request)); 2934 EXPECT_EQ(host, manager->GetFrameHostForNavigation(navigation_request.get()));
2935 2935
2936 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI()); 2936 EXPECT_EQ(web_ui, manager->GetNavigatingWebUI());
2937 EXPECT_EQ(web_ui, host->web_ui()); 2937 EXPECT_EQ(web_ui, host->web_ui());
2938 EXPECT_EQ(web_ui, host->pending_web_ui()); 2938 EXPECT_EQ(web_ui, host->pending_web_ui());
2939 EXPECT_FALSE(GetPendingFrameHost(manager)); 2939 EXPECT_FALSE(GetPendingFrameHost(manager));
2940 2940
2941 // The RenderFrameHost committed. 2941 // The RenderFrameHost committed.
2942 manager->DidNavigateFrame(host, true); 2942 manager->DidNavigateFrame(host, true);
2943 EXPECT_EQ(web_ui, host->web_ui()); 2943 EXPECT_EQ(web_ui, host->web_ui());
2944 EXPECT_FALSE(manager->GetNavigatingWebUI()); 2944 EXPECT_FALSE(manager->GetNavigatingWebUI());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2988 RenderFrameHostImpl* speculative_host = GetPendingFrameHost(manager); 2988 RenderFrameHostImpl* speculative_host = GetPendingFrameHost(manager);
2989 EXPECT_TRUE(speculative_host); 2989 EXPECT_TRUE(speculative_host);
2990 WebUIImpl* next_web_ui = manager->GetNavigatingWebUI(); 2990 WebUIImpl* next_web_ui = manager->GetNavigatingWebUI();
2991 EXPECT_TRUE(next_web_ui); 2991 EXPECT_TRUE(next_web_ui);
2992 EXPECT_EQ(next_web_ui, speculative_host->web_ui()); 2992 EXPECT_EQ(next_web_ui, speculative_host->web_ui());
2993 EXPECT_NE(next_web_ui, manager->current_frame_host()->web_ui()); 2993 EXPECT_NE(next_web_ui, manager->current_frame_host()->web_ui());
2994 EXPECT_FALSE(speculative_host->pending_web_ui()); 2994 EXPECT_FALSE(speculative_host->pending_web_ui());
2995 2995
2996 // Prepare to commit, update the navigating RenderFrameHost. 2996 // Prepare to commit, update the navigating RenderFrameHost.
2997 EXPECT_EQ(speculative_host, 2997 EXPECT_EQ(speculative_host,
2998 manager->GetFrameHostForNavigation(*navigation_request)); 2998 manager->GetFrameHostForNavigation(navigation_request.get()));
2999 2999
3000 EXPECT_TRUE(manager->current_frame_host()->web_ui()); 3000 EXPECT_TRUE(manager->current_frame_host()->web_ui());
3001 EXPECT_FALSE(manager->current_frame_host()->pending_web_ui()); 3001 EXPECT_FALSE(manager->current_frame_host()->pending_web_ui());
3002 EXPECT_EQ(speculative_host, GetPendingFrameHost(manager)); 3002 EXPECT_EQ(speculative_host, GetPendingFrameHost(manager));
3003 EXPECT_NE(next_web_ui, manager->current_frame_host()->web_ui()); 3003 EXPECT_NE(next_web_ui, manager->current_frame_host()->web_ui());
3004 EXPECT_EQ(next_web_ui, speculative_host->web_ui()); 3004 EXPECT_EQ(next_web_ui, speculative_host->web_ui());
3005 EXPECT_EQ(next_web_ui, manager->GetNavigatingWebUI()); 3005 EXPECT_EQ(next_web_ui, manager->GetNavigatingWebUI());
3006 EXPECT_FALSE(speculative_host->pending_web_ui()); 3006 EXPECT_FALSE(speculative_host->pending_web_ui());
3007 3007
3008 // The RenderFrameHost committed. 3008 // The RenderFrameHost committed.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3095 commit_params.should_enforce_strict_mixed_content_checking = false; 3095 commit_params.should_enforce_strict_mixed_content_checking = false;
3096 child_host->SendNavigateWithParams(&commit_params); 3096 child_host->SendNavigateWithParams(&commit_params);
3097 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC( 3097 EXPECT_NO_FATAL_FAILURE(CheckMixedContentIPC(
3098 main_test_rfh(), false, proxy_to_parent->GetRoutingID())); 3098 main_test_rfh(), false, proxy_to_parent->GetRoutingID()));
3099 EXPECT_FALSE(root->child_at(0) 3099 EXPECT_FALSE(root->child_at(0)
3100 ->current_replication_state() 3100 ->current_replication_state()
3101 .should_enforce_strict_mixed_content_checking); 3101 .should_enforce_strict_mixed_content_checking);
3102 } 3102 }
3103 3103
3104 } // namespace content 3104 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698