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

Side by Side Diff: content/browser/security_exploit_browsertest.cc

Issue 2758993002: Move the functions which block, resume and cancel requests for a frame route id out of ResourceDisp… (Closed)
Patch Set: Rebased to tip Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/containers/hash_tables.h" 8 #include "base/containers/hash_tables.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 request.headers = base::StringPrintf("Origin: %s\r\n", origin); 137 request.headers = base::StringPrintf("Origin: %s\r\n", origin);
138 return request; 138 return request;
139 } 139 }
140 140
141 void TryCreateDuplicateRequestIds(Shell* shell, bool block_loaders) { 141 void TryCreateDuplicateRequestIds(Shell* shell, bool block_loaders) {
142 NavigateToURL(shell, GURL("http://foo.com/simple_page.html")); 142 NavigateToURL(shell, GURL("http://foo.com/simple_page.html"));
143 RenderFrameHost* rfh = shell->web_contents()->GetMainFrame(); 143 RenderFrameHost* rfh = shell->web_contents()->GetMainFrame();
144 144
145 if (block_loaders) { 145 if (block_loaders) {
146 // Test the case where loaders are placed into blocked_loaders_map_. 146 // Test the case where loaders are placed into blocked_loaders_map_.
147 ResourceDispatcherHost::BlockRequestsForFrameFromUI(rfh); 147 rfh->BlockRequestsForFrame();
148 } 148 }
149 149
150 // URLRequestSlowDownloadJob waits for another request to kFinishDownloadUrl 150 // URLRequestSlowDownloadJob waits for another request to kFinishDownloadUrl
151 // to finish all pending requests. It is never sent, so the following URL 151 // to finish all pending requests. It is never sent, so the following URL
152 // blocks indefinitely, which is good because the request stays alive and the 152 // blocks indefinitely, which is good because the request stays alive and the
153 // test can try to reuse the request id without a race. 153 // test can try to reuse the request id without a race.
154 const char* blocking_url = net::URLRequestSlowDownloadJob::kUnknownSizeUrl; 154 const char* blocking_url = net::URLRequestSlowDownloadJob::kUnknownSizeUrl;
155 ResourceRequest request(CreateXHRRequest(blocking_url)); 155 ResourceRequest request(CreateXHRRequest(blocking_url));
156 156
157 // Use the same request id twice. 157 // Use the same request id twice.
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // separate task of the message loop, so ensure that the process is still 567 // separate task of the message loop, so ensure that the process is still
568 // considered alive. 568 // considered alive.
569 EXPECT_TRUE(root->current_frame_host()->GetProcess()->HasConnection()); 569 EXPECT_TRUE(root->current_frame_host()->GetProcess()->HasConnection());
570 570
571 exit_observer.Wait(); 571 exit_observer.Wait();
572 EXPECT_FALSE(exit_observer.did_exit_normally()); 572 EXPECT_FALSE(exit_observer.did_exit_normally());
573 ResourceDispatcherHost::Get()->SetDelegate(nullptr); 573 ResourceDispatcherHost::Get()->SetDelegate(nullptr);
574 } 574 }
575 575
576 } // namespace content 576 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | content/public/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698