| 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/macros.h" | 8 #include "base/macros.h" |
| 8 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 10 #include "content/browser/frame_host/navigation_controller_impl.h" | 11 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 11 #include "content/browser/frame_host/navigation_entry_impl.h" | 12 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 12 #include "content/browser/frame_host/navigation_request.h" | 13 #include "content/browser/frame_host/navigation_request.h" |
| 13 #include "content/browser/frame_host/navigation_request_info.h" | 14 #include "content/browser/frame_host/navigation_request_info.h" |
| 14 #include "content/browser/frame_host/navigator.h" | 15 #include "content/browser/frame_host/navigator.h" |
| 15 #include "content/browser/frame_host/navigator_impl.h" | 16 #include "content/browser/frame_host/navigator_impl.h" |
| 16 #include "content/browser/frame_host/render_frame_host_manager.h" | 17 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 17 #include "content/browser/site_instance_impl.h" | 18 #include "content/browser/site_instance_impl.h" |
| 18 #include "content/browser/streams/stream.h" | 19 #include "content/browser/streams/stream.h" |
| 19 #include "content/common/frame_messages.h" | 20 #include "content/common/frame_messages.h" |
| 20 #include "content/common/navigation_params.h" | 21 #include "content/common/navigation_params.h" |
| 21 #include "content/common/site_isolation_policy.h" | 22 #include "content/common/site_isolation_policy.h" |
| 22 #include "content/public/browser/navigation_data.h" | 23 #include "content/public/browser/navigation_data.h" |
| 23 #include "content/public/browser/stream_handle.h" | 24 #include "content/public/browser/stream_handle.h" |
| 25 #include "content/public/common/content_features.h" |
| 24 #include "content/public/common/url_constants.h" | 26 #include "content/public/common/url_constants.h" |
| 25 #include "content/public/common/url_utils.h" | 27 #include "content/public/common/url_utils.h" |
| 26 #include "content/public/test/mock_render_process_host.h" | 28 #include "content/public/test/mock_render_process_host.h" |
| 27 #include "content/public/test/test_utils.h" | 29 #include "content/public/test/test_utils.h" |
| 28 #include "content/test/browser_side_navigation_test_utils.h" | 30 #include "content/test/browser_side_navigation_test_utils.h" |
| 29 #include "content/test/test_navigation_url_loader.h" | 31 #include "content/test/test_navigation_url_loader.h" |
| 30 #include "content/test/test_render_frame_host.h" | 32 #include "content/test/test_render_frame_host.h" |
| 31 #include "content/test/test_web_contents.h" | 33 #include "content/test/test_web_contents.h" |
| 32 #include "net/base/load_flags.h" | 34 #include "net/base/load_flags.h" |
| 33 #include "net/http/http_response_headers.h" | 35 #include "net/http/http_response_headers.h" |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 TEST_F(NavigatorTestWithBrowserSideNavigation, Reload) { | 827 TEST_F(NavigatorTestWithBrowserSideNavigation, Reload) { |
| 826 const GURL kUrl("http://www.google.com/"); | 828 const GURL kUrl("http://www.google.com/"); |
| 827 contents()->NavigateAndCommit(kUrl); | 829 contents()->NavigateAndCommit(kUrl); |
| 828 | 830 |
| 829 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); | 831 FrameTreeNode* node = main_test_rfh()->frame_tree_node(); |
| 830 controller().Reload(false); | 832 controller().Reload(false); |
| 831 int entry_id = controller().GetPendingEntry()->GetUniqueID(); | 833 int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
| 832 // A NavigationRequest should have been generated. | 834 // A NavigationRequest should have been generated. |
| 833 NavigationRequest* main_request = node->navigation_request(); | 835 NavigationRequest* main_request = node->navigation_request(); |
| 834 ASSERT_TRUE(main_request != NULL); | 836 ASSERT_TRUE(main_request != NULL); |
| 835 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD, | 837 // TODO(toyoshim): Modify following checks once the feature is enabled. |
| 836 main_request->common_params().navigation_type); | 838 if (base::FeatureList::IsEnabled( |
| 839 features::kNonValidatingReloadOnNormalReload)) { |
| 840 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD_MAIN_RESOURCE, |
| 841 main_request->common_params().navigation_type); |
| 842 } else { |
| 843 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD, |
| 844 main_request->common_params().navigation_type); |
| 845 } |
| 837 main_test_rfh()->PrepareForCommit(); | 846 main_test_rfh()->PrepareForCommit(); |
| 838 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); | 847 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); |
| 839 | 848 |
| 840 main_test_rfh()->SendNavigate(0, entry_id, false, kUrl); | 849 main_test_rfh()->SendNavigate(0, entry_id, false, kUrl); |
| 841 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); | 850 EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); |
| 842 | 851 |
| 843 // Now do a shift+reload. | 852 // Now do a shift+reload. |
| 844 controller().ReloadBypassingCache(false); | 853 controller().ReloadBypassingCache(false); |
| 845 // A NavigationRequest should have been generated. | 854 // A NavigationRequest should have been generated. |
| 846 main_request = node->navigation_request(); | 855 main_request = node->navigation_request(); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 main_test_rfh()->PrepareForCommit(); | 1162 main_test_rfh()->PrepareForCommit(); |
| 1154 | 1163 |
| 1155 // Claim that the navigation was within same page. | 1164 // Claim that the navigation was within same page. |
| 1156 int bad_msg_count = process()->bad_msg_count(); | 1165 int bad_msg_count = process()->bad_msg_count(); |
| 1157 GetSpeculativeRenderFrameHost(node)->SendNavigateWithModificationCallback( | 1166 GetSpeculativeRenderFrameHost(node)->SendNavigateWithModificationCallback( |
| 1158 0, entry_id, true, kUrl2, base::Bind(SetWithinPage, kUrl1)); | 1167 0, entry_id, true, kUrl2, base::Bind(SetWithinPage, kUrl1)); |
| 1159 EXPECT_EQ(process()->bad_msg_count(), bad_msg_count + 1); | 1168 EXPECT_EQ(process()->bad_msg_count(), bad_msg_count + 1); |
| 1160 } | 1169 } |
| 1161 | 1170 |
| 1162 } // namespace content | 1171 } // namespace content |
| OLD | NEW |