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/test/histogram_tester.h" | 8 #include "base/test/histogram_tester.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/frame_host/cross_site_transferring_request.h" | 10 #include "content/browser/frame_host/cross_site_transferring_request.h" |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 contents()->OnGoToEntryAtOffset(-1); | 1079 contents()->OnGoToEntryAtOffset(-1); |
1080 // We should have a new pending RFH. | 1080 // We should have a new pending RFH. |
1081 // Note that in this case, the navigation has not committed, so evil_rfh will | 1081 // Note that in this case, the navigation has not committed, so evil_rfh will |
1082 // not be deleted yet. | 1082 // not be deleted yet. |
1083 EXPECT_NE(evil_rfh, contents()->GetPendingMainFrame()); | 1083 EXPECT_NE(evil_rfh, contents()->GetPendingMainFrame()); |
1084 EXPECT_NE(evil_rfh->GetRenderViewHost(), | 1084 EXPECT_NE(evil_rfh->GetRenderViewHost(), |
1085 contents()->GetPendingMainFrame()->GetRenderViewHost()); | 1085 contents()->GetPendingMainFrame()->GetRenderViewHost()); |
1086 | 1086 |
1087 // Before that RFH has committed, the evil page reloads itself. | 1087 // Before that RFH has committed, the evil page reloads itself. |
1088 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 1088 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
1089 params.page_id = 1; | |
1090 params.url = kUrl2; | 1089 params.url = kUrl2; |
1091 params.transition = ui::PAGE_TRANSITION_CLIENT_REDIRECT; | 1090 params.transition = ui::PAGE_TRANSITION_CLIENT_REDIRECT; |
1092 params.should_update_history = false; | 1091 params.should_update_history = false; |
1093 params.gesture = NavigationGestureAuto; | 1092 params.gesture = NavigationGestureAuto; |
1094 params.was_within_same_page = false; | 1093 params.was_within_same_page = false; |
1095 params.is_post = false; | 1094 params.is_post = false; |
1096 params.page_state = PageState::CreateFromURL(kUrl2); | 1095 params.page_state = PageState::CreateFromURL(kUrl2); |
1097 | 1096 |
1098 contents()->GetFrameTree()->root()->navigator()->DidNavigate(evil_rfh, | 1097 contents()->GetFrameTree()->root()->navigator()->DidNavigate(evil_rfh, 1, |
1099 params); | 1098 params); |
1100 | 1099 |
1101 // That should have cancelled the pending RFH, and the evil RFH should be the | 1100 // That should have cancelled the pending RFH, and the evil RFH should be the |
1102 // current one. | 1101 // current one. |
1103 EXPECT_TRUE(contents()->GetRenderManagerForTesting()-> | 1102 EXPECT_TRUE(contents()->GetRenderManagerForTesting()-> |
1104 pending_render_view_host() == NULL); | 1103 pending_render_view_host() == NULL); |
1105 EXPECT_TRUE(contents()->GetRenderManagerForTesting()->pending_frame_host() == | 1104 EXPECT_TRUE(contents()->GetRenderManagerForTesting()->pending_frame_host() == |
1106 NULL); | 1105 NULL); |
1107 EXPECT_EQ(evil_rfh, | 1106 EXPECT_EQ(evil_rfh, |
1108 contents()->GetRenderManagerForTesting()->current_frame_host()); | 1107 contents()->GetRenderManagerForTesting()->current_frame_host()); |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 pending_rfh->GetSiteInstance()->increment_active_frame_count(); | 1795 pending_rfh->GetSiteInstance()->increment_active_frame_count(); |
1797 | 1796 |
1798 contents()->GetMainFrame()->OnMessageReceived( | 1797 contents()->GetMainFrame()->OnMessageReceived( |
1799 FrameHostMsg_BeforeUnload_ACK(0, false, now, now)); | 1798 FrameHostMsg_BeforeUnload_ACK(0, false, now, now)); |
1800 EXPECT_FALSE(contents()->cross_navigation_pending()); | 1799 EXPECT_FALSE(contents()->cross_navigation_pending()); |
1801 EXPECT_FALSE(rfh_deleted_observer.deleted()); | 1800 EXPECT_FALSE(rfh_deleted_observer.deleted()); |
1802 } | 1801 } |
1803 } | 1802 } |
1804 | 1803 |
1805 } // namespace content | 1804 } // namespace content |
OLD | NEW |