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

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

Issue 2635533002: net: fix multiple use-after-scope issues in net_unittests. (Closed)
Patch Set: Created 3 years, 11 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/spdy/spdy_network_transaction_unittest.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 <memory> 5 #include <memory>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 5428 matching lines...) Expand 10 before | Expand all | Expand 10 after
5439 5439
5440 const AsyncLoggingUrlRequestDelegate::CancelStage kCancelStages[] = { 5440 const AsyncLoggingUrlRequestDelegate::CancelStage kCancelStages[] = {
5441 AsyncLoggingUrlRequestDelegate::CANCEL_ON_RECEIVED_REDIRECT, 5441 AsyncLoggingUrlRequestDelegate::CANCEL_ON_RECEIVED_REDIRECT,
5442 AsyncLoggingUrlRequestDelegate::CANCEL_ON_RESPONSE_STARTED, 5442 AsyncLoggingUrlRequestDelegate::CANCEL_ON_RESPONSE_STARTED,
5443 AsyncLoggingUrlRequestDelegate::CANCEL_ON_READ_COMPLETED, 5443 AsyncLoggingUrlRequestDelegate::CANCEL_ON_READ_COMPLETED,
5444 }; 5444 };
5445 5445
5446 for (size_t test_case = 0; test_case < arraysize(kCancelStages); 5446 for (size_t test_case = 0; test_case < arraysize(kCancelStages);
5447 ++test_case) { 5447 ++test_case) {
5448 AsyncLoggingUrlRequestDelegate request_delegate(kCancelStages[test_case]); 5448 AsyncLoggingUrlRequestDelegate request_delegate(kCancelStages[test_case]);
5449 TestNetLog net_log;
5449 TestURLRequestContext context(true); 5450 TestURLRequestContext context(true);
5450 TestNetLog net_log;
5451 context.set_network_delegate(NULL); 5451 context.set_network_delegate(NULL);
5452 context.set_net_log(&net_log); 5452 context.set_net_log(&net_log);
5453 context.Init(); 5453 context.Init();
5454 5454
5455 { 5455 {
5456 std::unique_ptr<URLRequest> r(context.CreateRequest( 5456 std::unique_ptr<URLRequest> r(context.CreateRequest(
5457 http_test_server()->GetURL("/server-redirect?simple.html"), 5457 http_test_server()->GetURL("/server-redirect?simple.html"),
5458 DEFAULT_PRIORITY, &request_delegate)); 5458 DEFAULT_PRIORITY, &request_delegate));
5459 LoadStateWithParam load_state = r->GetLoadState(); 5459 LoadStateWithParam load_state = r->GetLoadState();
5460 r->Start(); 5460 r->Start();
(...skipping 5291 matching lines...) Expand 10 before | Expand all | Expand 10 after
10752 AddTestInterceptor()->set_main_intercept_job(std::move(job)); 10752 AddTestInterceptor()->set_main_intercept_job(std::move(job));
10753 10753
10754 req->Start(); 10754 req->Start();
10755 req->Cancel(); 10755 req->Cancel();
10756 base::RunLoop().RunUntilIdle(); 10756 base::RunLoop().RunUntilIdle();
10757 EXPECT_EQ(ERR_ABORTED, d.request_status()); 10757 EXPECT_EQ(ERR_ABORTED, d.request_status());
10758 EXPECT_EQ(0, d.received_redirect_count()); 10758 EXPECT_EQ(0, d.received_redirect_count());
10759 } 10759 }
10760 10760
10761 } // namespace net 10761 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_network_transaction_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698