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 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); | 1014 url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
1015 base::TimeTicks now = base::TimeTicks::Now(); | 1015 base::TimeTicks now = base::TimeTicks::Now(); |
1016 orig_rvh->OnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true, now, now)); | 1016 orig_rvh->OnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true, now, now)); |
1017 EXPECT_TRUE(contents()->cross_navigation_pending()); | 1017 EXPECT_TRUE(contents()->cross_navigation_pending()); |
1018 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>( | 1018 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>( |
1019 contents()->GetPendingRenderViewHost()); | 1019 contents()->GetPendingRenderViewHost()); |
1020 | 1020 |
1021 // Simulate the pending renderer's response, which leads to an unload request | 1021 // Simulate the pending renderer's response, which leads to an unload request |
1022 // being sent to orig_rvh. | 1022 // being sent to orig_rvh. |
1023 contents()->GetRenderManagerForTesting()->OnCrossSiteResponse( | 1023 contents()->GetRenderManagerForTesting()->OnCrossSiteResponse( |
1024 pending_rvh, GlobalRequestID(0, 0)); | 1024 pending_rvh, GlobalRequestID(0, 0), false, GURL(), Referrer(), 1); |
1025 | 1025 |
1026 // Suppose the original renderer navigates now, while the unload request is in | 1026 // Suppose the original renderer navigates now, while the unload request is in |
1027 // flight. We should ignore it, wait for the unload ack, and let the pending | 1027 // flight. We should ignore it, wait for the unload ack, and let the pending |
1028 // request continue. Otherwise, the contents may close spontaneously or stop | 1028 // request continue. Otherwise, the contents may close spontaneously or stop |
1029 // responding to navigation requests. (See bug 23942.) | 1029 // responding to navigation requests. (See bug 23942.) |
1030 ViewHostMsg_FrameNavigate_Params params1a; | 1030 ViewHostMsg_FrameNavigate_Params params1a; |
1031 InitNavigateParams(¶ms1a, 2, GURL("http://www.google.com/foo"), | 1031 InitNavigateParams(¶ms1a, 2, GURL("http://www.google.com/foo"), |
1032 PAGE_TRANSITION_TYPED); | 1032 PAGE_TRANSITION_TYPED); |
1033 orig_rvh->SendNavigate(2, GURL("http://www.google.com/foo")); | 1033 orig_rvh->SendNavigate(2, GURL("http://www.google.com/foo")); |
1034 | 1034 |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); | 2175 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); |
2176 | 2176 |
2177 contents()->OnFrameDetached(16, 265); | 2177 contents()->OnFrameDetached(16, 265); |
2178 EXPECT_EQ(4UL, root->child_at(2)->child_count()); | 2178 EXPECT_EQ(4UL, root->child_at(2)->child_count()); |
2179 | 2179 |
2180 contents()->OnFrameDetached(5, 15); | 2180 contents()->OnFrameDetached(5, 15); |
2181 EXPECT_EQ(2UL, root->child_count()); | 2181 EXPECT_EQ(2UL, root->child_count()); |
2182 } | 2182 } |
2183 | 2183 |
2184 } // namespace content | 2184 } // namespace content |
OLD | NEW |