OLD | NEW |
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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/feature_list.h" | 7 #include "base/feature_list.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 } | 822 } |
823 | 823 |
824 // PlzNavigate: Test that a reload navigation is properly signaled to the | 824 // PlzNavigate: Test that a reload navigation is properly signaled to the |
825 // RenderFrame when the navigation can commit. A speculative RenderFrameHost | 825 // RenderFrame when the navigation can commit. A speculative RenderFrameHost |
826 // should not be created at any step. | 826 // should not be created at any step. |
827 TEST_F(NavigatorTestWithBrowserSideNavigation, Reload) { | 827 TEST_F(NavigatorTestWithBrowserSideNavigation, Reload) { |
828 const GURL kUrl("http://www.google.com/"); | 828 const GURL kUrl("http://www.google.com/"); |
829 contents()->NavigateAndCommit(kUrl); | 829 contents()->NavigateAndCommit(kUrl); |
830 | 830 |
831 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); | 831 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); |
832 controller().Reload(false); | 832 controller().Reload(ReloadType::NORMAL, false); |
833 int entry_id = controller().GetPendingEntry()->GetUniqueID(); | 833 int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
834 // A NavigationRequest should have been generated. | 834 // A NavigationRequest should have been generated. |
835 NavigationRequest* main_request = node->navigation_request(); | 835 NavigationRequest* main_request = node->navigation_request(); |
836 ASSERT_TRUE(main_request != NULL); | 836 ASSERT_TRUE(main_request != NULL); |
837 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD_MAIN_RESOURCE, | 837 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD_MAIN_RESOURCE, |
838 main_request->common_params().navigation_type); | 838 main_request->common_params().navigation_type); |
839 main_test_rfh()->PrepareForCommit(); | 839 main_test_rfh()->PrepareForCommit(); |
840 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); | 840 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); |
841 | 841 |
842 main_test_rfh()->SendNavigate(entry_id, false, kUrl); | 842 main_test_rfh()->SendNavigate(entry_id, false, kUrl); |
843 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); | 843 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); |
844 | 844 |
845 // Now do a shift+reload. | 845 // Now do a shift+reload. |
846 controller().ReloadBypassingCache(false); | 846 controller().Reload(ReloadType::BYPASSING_CACHE, false); |
847 // A NavigationRequest should have been generated. | 847 // A NavigationRequest should have been generated. |
848 main_request = node->navigation_request(); | 848 main_request = node->navigation_request(); |
849 ASSERT_TRUE(main_request != NULL); | 849 ASSERT_TRUE(main_request != NULL); |
850 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE, | 850 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE, |
851 main_request->common_params().navigation_type); | 851 main_request->common_params().navigation_type); |
852 main_test_rfh()->PrepareForCommit(); | 852 main_test_rfh()->PrepareForCommit(); |
853 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); | 853 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); |
854 } | 854 } |
855 | 855 |
856 // PlzNavigate: Confirm that a speculative RenderFrameHost is used when | 856 // PlzNavigate: Confirm that a speculative RenderFrameHost is used when |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 | 1229 |
1230 // The first navigation commits. This should clear up the speculative RFH and | 1230 // The first navigation commits. This should clear up the speculative RFH and |
1231 // the ongoing NavigationRequest. | 1231 // the ongoing NavigationRequest. |
1232 speculative_rfh->SendNavigate(entry_id, true, kUrl2); | 1232 speculative_rfh->SendNavigate(entry_id, true, kUrl2); |
1233 EXPECT_FALSE(node->navigation_request()); | 1233 EXPECT_FALSE(node->navigation_request()); |
1234 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); | 1234 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); |
1235 EXPECT_EQ(speculative_rfh, main_test_rfh()); | 1235 EXPECT_EQ(speculative_rfh, main_test_rfh()); |
1236 } | 1236 } |
1237 | 1237 |
1238 } // namespace content | 1238 } // namespace content |
OLD | NEW |