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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); | 939 url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
940 base::TimeTicks now = base::TimeTicks::Now(); | 940 base::TimeTicks now = base::TimeTicks::Now(); |
941 orig_rvh->OnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true, now, now)); | 941 orig_rvh->OnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true, now, now)); |
942 EXPECT_TRUE(contents()->cross_navigation_pending()); | 942 EXPECT_TRUE(contents()->cross_navigation_pending()); |
943 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>( | 943 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>( |
944 contents()->GetPendingRenderViewHost()); | 944 contents()->GetPendingRenderViewHost()); |
945 | 945 |
946 // Simulate the pending renderer's response, which leads to an unload request | 946 // Simulate the pending renderer's response, which leads to an unload request |
947 // being sent to orig_rvh. | 947 // being sent to orig_rvh. |
948 contents()->GetRenderManagerForTesting()->OnCrossSiteResponse( | 948 contents()->GetRenderManagerForTesting()->OnCrossSiteResponse( |
949 pending_rvh, GlobalRequestID(0, 0)); | 949 pending_rvh, GURL(), Referrer(), 1, GlobalRequestID(0, 0)); |
950 | 950 |
951 // Suppose the original renderer navigates now, while the unload request is in | 951 // Suppose the original renderer navigates now, while the unload request is in |
952 // flight. We should ignore it, wait for the unload ack, and let the pending | 952 // flight. We should ignore it, wait for the unload ack, and let the pending |
953 // request continue. Otherwise, the contents may close spontaneously or stop | 953 // request continue. Otherwise, the contents may close spontaneously or stop |
954 // responding to navigation requests. (See bug 23942.) | 954 // responding to navigation requests. (See bug 23942.) |
955 ViewHostMsg_FrameNavigate_Params params1a; | 955 ViewHostMsg_FrameNavigate_Params params1a; |
956 InitNavigateParams(¶ms1a, 2, GURL("http://www.google.com/foo"), | 956 InitNavigateParams(¶ms1a, 2, GURL("http://www.google.com/foo"), |
957 PAGE_TRANSITION_TYPED); | 957 PAGE_TRANSITION_TYPED); |
958 orig_rvh->SendNavigate(2, GURL("http://www.google.com/foo")); | 958 orig_rvh->SendNavigate(2, GURL("http://www.google.com/foo")); |
959 | 959 |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2100 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); | 2100 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); |
2101 | 2101 |
2102 contents()->OnFrameDetached(16, 265); | 2102 contents()->OnFrameDetached(16, 265); |
2103 EXPECT_EQ(4UL, root->child_at(2)->child_count()); | 2103 EXPECT_EQ(4UL, root->child_at(2)->child_count()); |
2104 | 2104 |
2105 contents()->OnFrameDetached(5, 15); | 2105 contents()->OnFrameDetached(5, 15); |
2106 EXPECT_EQ(2UL, root->child_count()); | 2106 EXPECT_EQ(2UL, root->child_count()); |
2107 } | 2107 } |
2108 | 2108 |
2109 } // namespace content | 2109 } // namespace content |
OLD | NEW |