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

Unified Diff: chrome/browser/prerender/prerender_tracker_unittest.cc

Issue 407093011: Allow URLRequests from one context to have different NetworkDelegates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new tests Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prerender/prerender_tracker_unittest.cc
diff --git a/chrome/browser/prerender/prerender_tracker_unittest.cc b/chrome/browser/prerender/prerender_tracker_unittest.cc
index 54b77a96938de5f50ad8b700640f74ef833b5efc..2d20c455d1e650b0cf9c88b282c583763f42f00a 100644
--- a/chrome/browser/prerender/prerender_tracker_unittest.cc
+++ b/chrome/browser/prerender/prerender_tracker_unittest.cc
@@ -224,12 +224,12 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectResume) {
// Fake a request.
net::TestURLRequestContext url_request_context;
DeferredRedirectDelegate delegate;
- net::URLRequest request(
+ scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest(
content::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
net::DEFAULT_PRIORITY,
&delegate,
- &url_request_context);
- content::ResourceRequestInfo::AllocateForTesting(&request,
+ NULL));
+ content::ResourceRequestInfo::AllocateForTesting(request.get(),
content::RESOURCE_TYPE_IMAGE,
NULL,
kDefaultChildId,
@@ -238,11 +238,11 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectResume) {
true);
// Install a prerender throttle.
- PrerenderResourceThrottle throttle(&request);
+ PrerenderResourceThrottle throttle(request.get());
delegate.SetThrottle(&throttle);
// Start the request and wait for a redirect.
- request.Start();
+ request->Start();
delegate.Run();
EXPECT_TRUE(delegate.was_deferred());
// This calls WillRedirectRequestOnUI().
@@ -267,13 +267,13 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectMainFrame) {
// Fake a request.
net::TestURLRequestContext url_request_context;
DeferredRedirectDelegate delegate;
- net::URLRequest request(
+ scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest(
content::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
net::DEFAULT_PRIORITY,
&delegate,
- &url_request_context);
+ NULL));
content::ResourceRequestInfo::AllocateForTesting(
- &request,
+ request.get(),
content::RESOURCE_TYPE_MAIN_FRAME,
NULL,
kDefaultChildId,
@@ -282,12 +282,12 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectMainFrame) {
true);
// Install a prerender throttle.
- PrerenderResourceThrottle throttle(&request);
+ PrerenderResourceThrottle throttle(request.get());
delegate.SetThrottle(&throttle);
// Start the request and wait for a redirect. This time, it should
// not be deferred.
- request.Start();
+ request->Start();
delegate.Run();
// This calls WillRedirectRequestOnUI().
RunEvents();
@@ -309,12 +309,12 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectSyncXHR) {
// Fake a request.
net::TestURLRequestContext url_request_context;
DeferredRedirectDelegate delegate;
- net::URLRequest request(
+ scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest(
content::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)),
net::DEFAULT_PRIORITY,
&delegate,
- &url_request_context);
- content::ResourceRequestInfo::AllocateForTesting(&request,
+ NULL));
+ content::ResourceRequestInfo::AllocateForTesting(request.get(),
content::RESOURCE_TYPE_XHR,
NULL,
kDefaultChildId,
@@ -323,11 +323,11 @@ TEST_F(PrerenderTrackerTest, PrerenderThrottledRedirectSyncXHR) {
false);
// Install a prerender throttle.
- PrerenderResourceThrottle throttle(&request);
+ PrerenderResourceThrottle throttle(request.get());
delegate.SetThrottle(&throttle);
// Start the request and wait for a redirect.
- request.Start();
+ request->Start();
delegate.Run();
// This calls WillRedirectRequestOnUI().
RunEvents();
« no previous file with comments | « chrome/browser/policy/url_blacklist_manager_unittest.cc ('k') | chrome/browser/search/iframe_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698