| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "content/browser/frame_host/cross_site_transferring_request.h" | 7 #include "content/browser/frame_host/cross_site_transferring_request.h" |
| 8 #include "content/browser/frame_host/interstitial_page_impl.h" | 8 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 9 #include "content/browser/frame_host/navigation_entry_impl.h" | 9 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 10 #include "content/browser/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 | 1151 |
| 1152 // Navigate to new site, with the beforeunload request in flight. | 1152 // Navigate to new site, with the beforeunload request in flight. |
| 1153 const GURL url2("http://www.yahoo.com"); | 1153 const GURL url2("http://www.yahoo.com"); |
| 1154 controller().LoadURL( | 1154 controller().LoadURL( |
| 1155 url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); | 1155 url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
| 1156 TestRenderFrameHost* pending_rfh = contents()->GetPendingMainFrame(); | 1156 TestRenderFrameHost* pending_rfh = contents()->GetPendingMainFrame(); |
| 1157 EXPECT_TRUE(contents()->cross_navigation_pending()); | 1157 EXPECT_TRUE(contents()->cross_navigation_pending()); |
| 1158 EXPECT_TRUE(orig_rfh->GetRenderViewHost()->is_waiting_for_beforeunload_ack()); | 1158 EXPECT_TRUE(orig_rfh->GetRenderViewHost()->is_waiting_for_beforeunload_ack()); |
| 1159 | 1159 |
| 1160 // Suppose the first navigation tries to commit now, with a | 1160 // Suppose the first navigation tries to commit now, with a |
| 1161 // FrameMsg_Stop in flight. This should not cancel the pending navigation, | 1161 // ViewMsg_Stop in flight. This should not cancel the pending navigation, |
| 1162 // but it should act as if the beforeunload ack arrived. | 1162 // but it should act as if the beforeunload ack arrived. |
| 1163 orig_rfh->SendNavigate(1, GURL("chrome://blah")); | 1163 orig_rfh->SendNavigate(1, GURL("chrome://blah")); |
| 1164 EXPECT_TRUE(contents()->cross_navigation_pending()); | 1164 EXPECT_TRUE(contents()->cross_navigation_pending()); |
| 1165 EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); | 1165 EXPECT_EQ(orig_rfh, contents()->GetMainFrame()); |
| 1166 EXPECT_FALSE( | 1166 EXPECT_FALSE( |
| 1167 orig_rfh->GetRenderViewHost()->is_waiting_for_beforeunload_ack()); | 1167 orig_rfh->GetRenderViewHost()->is_waiting_for_beforeunload_ack()); |
| 1168 | 1168 |
| 1169 // The pending navigation should be able to commit successfully. | 1169 // The pending navigation should be able to commit successfully. |
| 1170 contents()->TestDidNavigate(pending_rfh, 1, url2, PAGE_TRANSITION_TYPED); | 1170 contents()->TestDidNavigate(pending_rfh, 1, url2, PAGE_TRANSITION_TYPED); |
| 1171 EXPECT_FALSE(contents()->cross_navigation_pending()); | 1171 EXPECT_FALSE(contents()->cross_navigation_pending()); |
| (...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2679 contents->CommitPendingNavigation(); | 2679 contents->CommitPendingNavigation(); |
| 2680 EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount()); | 2680 EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount()); |
| 2681 EXPECT_EQ(1u, instance_webui->GetRelatedActiveContentsCount()); | 2681 EXPECT_EQ(1u, instance_webui->GetRelatedActiveContentsCount()); |
| 2682 | 2682 |
| 2683 contents.reset(); | 2683 contents.reset(); |
| 2684 EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount()); | 2684 EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount()); |
| 2685 EXPECT_EQ(0u, instance_webui->GetRelatedActiveContentsCount()); | 2685 EXPECT_EQ(0u, instance_webui->GetRelatedActiveContentsCount()); |
| 2686 } | 2686 } |
| 2687 | 2687 |
| 2688 } // namespace content | 2688 } // namespace content |
| OLD | NEW |