Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 143183009: When cross-site navigations are cancelled, delete the request being transferred (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: *Really* remove AbortTransfer Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/site_per_process_browsertest.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/interstitial_page_impl.h" 7 #include "content/browser/frame_host/interstitial_page_impl.h"
8 #include "content/browser/frame_host/navigation_entry_impl.h" 8 #include "content/browser/frame_host/navigation_entry_impl.h"
9 #include "content/browser/renderer_host/cross_site_transferring_request.h"
9 #include "content/browser/renderer_host/render_view_host_impl.h" 10 #include "content/browser/renderer_host/render_view_host_impl.h"
10 #include "content/browser/site_instance_impl.h" 11 #include "content/browser/site_instance_impl.h"
11 #include "content/browser/webui/web_ui_controller_factory_registry.h" 12 #include "content/browser/webui/web_ui_controller_factory_registry.h"
12 #include "content/common/frame_messages.h" 13 #include "content/common/frame_messages.h"
13 #include "content/common/view_messages.h" 14 #include "content/common/view_messages.h"
14 #include "content/public/browser/global_request_id.h" 15 #include "content/public/browser/global_request_id.h"
15 #include "content/public/browser/interstitial_page_delegate.h" 16 #include "content/public/browser/interstitial_page_delegate.h"
16 #include "content/public/browser/navigation_details.h" 17 #include "content/public/browser/navigation_details.h"
17 #include "content/public/browser/notification_details.h" 18 #include "content/public/browser/notification_details.h"
18 #include "content/public/browser/notification_source.h" 19 #include "content/public/browser/notification_source.h"
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 orig_rvh->OnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true, now, now)); 1083 orig_rvh->OnMessageReceived(ViewHostMsg_ShouldClose_ACK(0, true, now, now));
1083 EXPECT_TRUE(contents()->cross_navigation_pending()); 1084 EXPECT_TRUE(contents()->cross_navigation_pending());
1084 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>( 1085 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>(
1085 contents()->GetPendingRenderViewHost()); 1086 contents()->GetPendingRenderViewHost());
1086 1087
1087 // Simulate the pending renderer's response, which leads to an unload request 1088 // Simulate the pending renderer's response, which leads to an unload request
1088 // being sent to orig_rvh. 1089 // being sent to orig_rvh.
1089 std::vector<GURL> url_chain; 1090 std::vector<GURL> url_chain;
1090 url_chain.push_back(GURL()); 1091 url_chain.push_back(GURL());
1091 contents()->GetRenderManagerForTesting()->OnCrossSiteResponse( 1092 contents()->GetRenderManagerForTesting()->OnCrossSiteResponse(
1092 pending_rvh, GlobalRequestID(0, 0), false, url_chain, Referrer(), 1093 pending_rvh, GlobalRequestID(0, 0),
1093 PAGE_TRANSITION_TYPED, 1, false); 1094 scoped_ptr<CrossSiteTransferringRequest>(), url_chain,
1095 Referrer(), PAGE_TRANSITION_TYPED, 1, false);
1094 1096
1095 // Suppose the original renderer navigates now, while the unload request is in 1097 // Suppose the original renderer navigates now, while the unload request is in
1096 // flight. We should ignore it, wait for the unload ack, and let the pending 1098 // flight. We should ignore it, wait for the unload ack, and let the pending
1097 // request continue. Otherwise, the contents may close spontaneously or stop 1099 // request continue. Otherwise, the contents may close spontaneously or stop
1098 // responding to navigation requests. (See bug 23942.) 1100 // responding to navigation requests. (See bug 23942.)
1099 FrameHostMsg_DidCommitProvisionalLoad_Params params1a; 1101 FrameHostMsg_DidCommitProvisionalLoad_Params params1a;
1100 InitNavigateParams(&params1a, 2, GURL("http://www.google.com/foo"), 1102 InitNavigateParams(&params1a, 2, GURL("http://www.google.com/foo"),
1101 PAGE_TRANSITION_TYPED); 1103 PAGE_TRANSITION_TYPED);
1102 orig_rvh->SendNavigate(2, GURL("http://www.google.com/foo")); 1104 orig_rvh->SendNavigate(2, GURL("http://www.google.com/foo"));
1103 1105
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 EXPECT_EQ(capture_size, contents()->GetPreferredSize()); 2212 EXPECT_EQ(capture_size, contents()->GetPreferredSize());
2211 2213
2212 // Decrement capturer count, and since the count has dropped to zero, the 2214 // Decrement capturer count, and since the count has dropped to zero, the
2213 // original preferred size should be restored. 2215 // original preferred size should be restored.
2214 contents()->DecrementCapturerCount(); 2216 contents()->DecrementCapturerCount();
2215 EXPECT_EQ(0, contents()->GetCapturerCount()); 2217 EXPECT_EQ(0, contents()->GetCapturerCount());
2216 EXPECT_EQ(original_preferred_size, contents()->GetPreferredSize()); 2218 EXPECT_EQ(original_preferred_size, contents()->GetPreferredSize());
2217 } 2219 }
2218 2220
2219 } // namespace content 2221 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/site_per_process_browsertest.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698