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

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: Add unittest (quite artificial) 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
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_F(URLRequestTest, URLRequestRedirectJobDetachRequestNoCrash) {
9214 // URLRequest should be canceled correctly and with detached request
9215 // URLRequestRedirectJob should not crash in StartAsync.
9216 // See http://crbug.com/508900
mmenke 2015/07/22 19:05:04 nit: Method descriptions should go before the met
9217
9218 TestDelegate d;
9219 scoped_ptr<URLRequest> req(default_context_.CreateRequest(
9220 GURL("http://not-a-real-domain/"), DEFAULT_PRIORITY, &d));
9221
9222 URLRequestRedirectJob* job = new URLRequestRedirectJob(
9223 req.get(), &default_network_delegate_,
9224 GURL("http://this-should-never-be-navigated-to/"),
9225 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT, "Jumbo shrimp");
9226 AddTestInterceptor()->set_main_intercept_job(job);
9227
9228 req->Start();
9229 req->Cancel();
9230 job->DetachRequest();
9231 base::RunLoop().RunUntilIdle();
9232 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status());
9233 EXPECT_EQ(0, d.received_redirect_count());
9234 }
9235
9213 } // namespace net 9236 } // namespace net
OLDNEW
« net/url_request/url_request_redirect_job.cc ('K') | « 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