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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 1232113002: Prevent URLRequestRedirectJob from doing async execution (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Override Kill() Created 5 years, 5 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
« no previous file with comments | « net/url_request/url_request_redirect_job.cc ('k') | no next file » | 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #endif 10 #endif
(...skipping 9192 matching lines...) Expand 10 before | Expand all | Expand 10 after
9203 scoped_ptr<URLRequest> req(context.CreateRequest( 9203 scoped_ptr<URLRequest> req(context.CreateRequest(
9204 GURL("http://test_intercept/foo"), DEFAULT_PRIORITY, &d)); 9204 GURL("http://test_intercept/foo"), DEFAULT_PRIORITY, &d));
9205 9205
9206 EXPECT_FALSE(req->response_info().network_accessed); 9206 EXPECT_FALSE(req->response_info().network_accessed);
9207 9207
9208 req->Start(); 9208 req->Start();
9209 base::RunLoop().Run(); 9209 base::RunLoop().Run();
9210 EXPECT_TRUE(req->response_info().network_accessed); 9210 EXPECT_TRUE(req->response_info().network_accessed);
9211 } 9211 }
9212 9212
9213 // Test that URLRequest is canceled correctly and with detached request
9214 // URLRequestRedirectJob does not crash in StartAsync.
9215 // See http://crbug.com/508900
9216 TEST_F(URLRequestTest, URLRequestRedirectJobDetachRequestNoCrash) {
9217 TestDelegate d;
9218 scoped_ptr<URLRequest> req(default_context_.CreateRequest(
9219 GURL("http://not-a-real-domain/"), DEFAULT_PRIORITY, &d));
9220
9221 URLRequestRedirectJob* job = new URLRequestRedirectJob(
9222 req.get(), &default_network_delegate_,
9223 GURL("http://this-should-never-be-navigated-to/"),
9224 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT, "Jumbo shrimp");
9225 AddTestInterceptor()->set_main_intercept_job(job);
9226
9227 req->Start();
9228 req->Cancel();
9229 job->DetachRequest();
9230 base::RunLoop().RunUntilIdle();
9231 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status());
9232 EXPECT_EQ(0, d.received_redirect_count());
9233 }
9234
9213 } // namespace net 9235 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_redirect_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698