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

Side by Side Diff: content/public/test/test_download_request_handler.cc

Issue 1897033002: Reland 'Convert //net and //chromecast to std::unordered_*' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix TestDownloadRequestHandler Created 4 years, 8 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 | « chromecast/net/net_util_cast.cc ('k') | net/android/network_change_notifier_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/public/test/test_download_request_handler.h" 5 #include "content/public/test/test_download_request_handler.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 new Interceptor(url, client_task_runner)); 491 new Interceptor(url, client_task_runner));
492 base::WeakPtr<Interceptor> weak_reference = 492 base::WeakPtr<Interceptor> weak_reference =
493 interceptor->weak_ptr_factory_.GetWeakPtr(); 493 interceptor->weak_ptr_factory_.GetWeakPtr();
494 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); 494 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
495 filter->AddUrlInterceptor(url, std::move(interceptor)); 495 filter->AddUrlInterceptor(url, std::move(interceptor));
496 return weak_reference; 496 return weak_reference;
497 } 497 }
498 498
499 void TestDownloadRequestHandler::Interceptor::Unregister() { 499 void TestDownloadRequestHandler::Interceptor::Unregister() {
500 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); 500 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
501 filter->RemoveUrlHandler(url_); 501 GURL url = url_; // Make a copy as |this| will be deleted.
502 filter->RemoveUrlHandler(url);
502 // We are deleted now since the filter owned |this|. 503 // We are deleted now since the filter owned |this|.
503 } 504 }
504 505
505 void TestDownloadRequestHandler::Interceptor::SetJobFactory( 506 void TestDownloadRequestHandler::Interceptor::SetJobFactory(
506 const JobFactory& job_factory) { 507 const JobFactory& job_factory) {
507 job_factory_ = job_factory; 508 job_factory_ = job_factory;
508 } 509 }
509 510
510 void TestDownloadRequestHandler::Interceptor::GetAndResetCompletedRequests( 511 void TestDownloadRequestHandler::Interceptor::GetAndResetCompletedRequests(
511 TestDownloadRequestHandler::CompletedRequests* requests) { 512 TestDownloadRequestHandler::CompletedRequests* requests) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 base::RunLoop run_loop; 670 base::RunLoop run_loop;
670 BrowserThread::PostTaskAndReply( 671 BrowserThread::PostTaskAndReply(
671 BrowserThread::IO, FROM_HERE, 672 BrowserThread::IO, FROM_HERE,
672 base::Bind(&Interceptor::GetAndResetCompletedRequests, interceptor_, 673 base::Bind(&Interceptor::GetAndResetCompletedRequests, interceptor_,
673 requests), 674 requests),
674 run_loop.QuitClosure()); 675 run_loop.QuitClosure());
675 run_loop.Run(); 676 run_loop.Run();
676 } 677 }
677 678
678 } // namespace content 679 } // namespace content
OLDNEW
« no previous file with comments | « chromecast/net/net_util_cast.cc ('k') | net/android/network_change_notifier_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698