OLD | NEW |
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "content/browser/frame_host/cross_site_transferring_request.h" | 9 #include "content/browser/frame_host/cross_site_transferring_request.h" |
10 #include "content/browser/frame_host/navigation_before_commit_info.h" | 10 #include "content/browser/frame_host/navigation_before_commit_info.h" |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 contents()->OnGoToEntryAtOffset(-1); | 1008 contents()->OnGoToEntryAtOffset(-1); |
1009 // We should have a new pending RFH. | 1009 // We should have a new pending RFH. |
1010 // Note that in this case, the navigation has not committed, so evil_rfh will | 1010 // Note that in this case, the navigation has not committed, so evil_rfh will |
1011 // not be deleted yet. | 1011 // not be deleted yet. |
1012 EXPECT_NE(evil_rfh, contents()->GetPendingMainFrame()); | 1012 EXPECT_NE(evil_rfh, contents()->GetPendingMainFrame()); |
1013 EXPECT_NE(evil_rfh->GetRenderViewHost(), | 1013 EXPECT_NE(evil_rfh->GetRenderViewHost(), |
1014 contents()->GetPendingMainFrame()->GetRenderViewHost()); | 1014 contents()->GetPendingMainFrame()->GetRenderViewHost()); |
1015 | 1015 |
1016 // Before that RFH has committed, the evil page reloads itself. | 1016 // Before that RFH has committed, the evil page reloads itself. |
1017 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 1017 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
1018 params.page_id = 1; | |
1019 params.url = kUrl2; | 1018 params.url = kUrl2; |
1020 params.transition = PAGE_TRANSITION_CLIENT_REDIRECT; | 1019 params.transition = PAGE_TRANSITION_CLIENT_REDIRECT; |
1021 params.should_update_history = false; | 1020 params.should_update_history = false; |
1022 params.gesture = NavigationGestureAuto; | 1021 params.gesture = NavigationGestureAuto; |
1023 params.was_within_same_page = false; | 1022 params.was_within_same_page = false; |
1024 params.is_post = false; | 1023 params.is_post = false; |
1025 params.page_state = PageState::CreateFromURL(kUrl2); | 1024 params.page_state = PageState::CreateFromURL(kUrl2); |
1026 | 1025 |
1027 contents()->GetFrameTree()->root()->navigator()->DidNavigate(evil_rfh, | 1026 contents()->GetFrameTree()->root()->navigator()->DidNavigate(evil_rfh, 1, |
1028 params); | 1027 params); |
1029 | 1028 |
1030 // That should have cancelled the pending RFH, and the evil RFH should be the | 1029 // That should have cancelled the pending RFH, and the evil RFH should be the |
1031 // current one. | 1030 // current one. |
1032 EXPECT_TRUE(contents()->GetRenderManagerForTesting()-> | 1031 EXPECT_TRUE(contents()->GetRenderManagerForTesting()-> |
1033 pending_render_view_host() == NULL); | 1032 pending_render_view_host() == NULL); |
1034 EXPECT_TRUE(contents()->GetRenderManagerForTesting()->pending_frame_host() == | 1033 EXPECT_TRUE(contents()->GetRenderManagerForTesting()->pending_frame_host() == |
1035 NULL); | 1034 NULL); |
1036 EXPECT_EQ(evil_rfh, | 1035 EXPECT_EQ(evil_rfh, |
1037 contents()->GetRenderManagerForTesting()->current_frame_host()); | 1036 contents()->GetRenderManagerForTesting()->current_frame_host()); |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); | 1843 EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); |
1845 | 1844 |
1846 // Confirms that a valid, request-matching commit is correctly processed. | 1845 // Confirms that a valid, request-matching commit is correctly processed. |
1847 nbc_info.navigation_url = kUrl2; | 1846 nbc_info.navigation_url = kUrl2; |
1848 nbc_info.navigation_request_id = request_id2; | 1847 nbc_info.navigation_request_id = request_id2; |
1849 render_manager->CommitNavigation(nbc_info); | 1848 render_manager->CommitNavigation(nbc_info); |
1850 EXPECT_EQ(kUrl2_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); | 1849 EXPECT_EQ(kUrl2_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); |
1851 } | 1850 } |
1852 | 1851 |
1853 } // namespace content | 1852 } // namespace content |
OLD | NEW |