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/renderer_host/render_view_host_impl.h" | 7 #include "content/browser/renderer_host/render_view_host_impl.h" |
8 #include "content/browser/renderer_host/test_render_view_host.h" | 8 #include "content/browser/renderer_host/test_render_view_host.h" |
9 #include "content/browser/site_instance_impl.h" | 9 #include "content/browser/site_instance_impl.h" |
10 #include "content/browser/web_contents/frame_tree_node.h" | 10 #include "content/browser/web_contents/frame_tree_node.h" |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); | 1055 url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
1056 base::TimeTicks now = base::TimeTicks::Now(); | 1056 base::TimeTicks now = base::TimeTicks::Now(); |
1057 orig_rvh->OnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true, now, now)); | 1057 orig_rvh->OnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true, now, now)); |
1058 EXPECT_TRUE(contents()->cross_navigation_pending()); | 1058 EXPECT_TRUE(contents()->cross_navigation_pending()); |
1059 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>( | 1059 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>( |
1060 contents()->GetPendingRenderViewHost()); | 1060 contents()->GetPendingRenderViewHost()); |
1061 | 1061 |
1062 // Simulate the pending renderer's response, which leads to an unload request | 1062 // Simulate the pending renderer's response, which leads to an unload request |
1063 // being sent to orig_rvh. | 1063 // being sent to orig_rvh. |
1064 contents()->GetRenderManagerForTesting()->OnCrossSiteResponse( | 1064 contents()->GetRenderManagerForTesting()->OnCrossSiteResponse( |
1065 pending_rvh, GlobalRequestID(0, 0)); | 1065 pending_rvh, GlobalRequestID(0, 0), false, GURL(), Referrer(), 1); |
1066 | 1066 |
1067 // Suppose the original renderer navigates now, while the unload request is in | 1067 // Suppose the original renderer navigates now, while the unload request is in |
1068 // flight. We should ignore it, wait for the unload ack, and let the pending | 1068 // flight. We should ignore it, wait for the unload ack, and let the pending |
1069 // request continue. Otherwise, the contents may close spontaneously or stop | 1069 // request continue. Otherwise, the contents may close spontaneously or stop |
1070 // responding to navigation requests. (See bug 23942.) | 1070 // responding to navigation requests. (See bug 23942.) |
1071 ViewHostMsg_FrameNavigate_Params params1a; | 1071 ViewHostMsg_FrameNavigate_Params params1a; |
1072 InitNavigateParams(¶ms1a, 2, GURL("http://www.google.com/foo"), | 1072 InitNavigateParams(¶ms1a, 2, GURL("http://www.google.com/foo"), |
1073 PAGE_TRANSITION_TYPED); | 1073 PAGE_TRANSITION_TYPED); |
1074 orig_rvh->SendNavigate(2, GURL("http://www.google.com/foo")); | 1074 orig_rvh->SendNavigate(2, GURL("http://www.google.com/foo")); |
1075 | 1075 |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); | 2216 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); |
2217 | 2217 |
2218 contents()->OnFrameDetached(16, 265); | 2218 contents()->OnFrameDetached(16, 265); |
2219 EXPECT_EQ(4UL, root->child_at(2)->child_count()); | 2219 EXPECT_EQ(4UL, root->child_at(2)->child_count()); |
2220 | 2220 |
2221 contents()->OnFrameDetached(5, 15); | 2221 contents()->OnFrameDetached(5, 15); |
2222 EXPECT_EQ(2UL, root->child_count()); | 2222 EXPECT_EQ(2UL, root->child_count()); |
2223 } | 2223 } |
2224 | 2224 |
2225 } // namespace content | 2225 } // namespace content |
OLD | NEW |