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

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

Issue 2076163002: Migrate SequencedTaskRunnerHandle calls to TaskRunnerHandle calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mix_c_Ab_1_scheduler_support_parallelTRH
Patch Set: Created 4 years, 6 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 | « content/browser/download/url_downloader.cc ('k') | tools/gn/bootstrap/bootstrap.py » ('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 <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/sequenced_task_runner.h" 18 #include "base/sequenced_task_runner.h"
19 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
20 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
21 #include "base/threading/sequenced_task_runner_handle.h" 21 #include "base/threading/task_runner_handle.h"
22 #include "base/threading/thread_task_runner_handle.h" 22 #include "base/threading/thread_task_runner_handle.h"
23 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 #include "net/base/io_buffer.h" 24 #include "net/base/io_buffer.h"
25 #include "net/http/http_request_headers.h" 25 #include "net/http/http_request_headers.h"
26 #include "net/http/http_response_headers.h" 26 #include "net/http/http_response_headers.h"
27 #include "net/url_request/url_request_filter.h" 27 #include "net/url_request/url_request_filter.h"
28 #include "net/url_request/url_request_interceptor.h" 28 #include "net/url_request/url_request_interceptor.h"
29 29
30 namespace content { 30 namespace content {
31 31
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 void TestDownloadRequestHandler::Parameters::ClearInjectedErrors() { 616 void TestDownloadRequestHandler::Parameters::ClearInjectedErrors() {
617 std::queue<InjectedError> empty_error_list; 617 std::queue<InjectedError> empty_error_list;
618 injected_errors.swap(empty_error_list); 618 injected_errors.swap(empty_error_list);
619 } 619 }
620 620
621 TestDownloadRequestHandler::TestDownloadRequestHandler() 621 TestDownloadRequestHandler::TestDownloadRequestHandler()
622 : TestDownloadRequestHandler(GetNextURLForDownloadInterceptor()) {} 622 : TestDownloadRequestHandler(GetNextURLForDownloadInterceptor()) {}
623 623
624 TestDownloadRequestHandler::TestDownloadRequestHandler(const GURL& url) 624 TestDownloadRequestHandler::TestDownloadRequestHandler(const GURL& url)
625 : url_(url) { 625 : url_(url) {
626 DCHECK(base::SequencedTaskRunnerHandle::IsSet()); 626 DCHECK(base::TaskRunnerHandle::HasSequencedTaskScope());
627 base::RunLoop run_loop; 627 base::RunLoop run_loop;
628 BrowserThread::PostTaskAndReplyWithResult( 628 BrowserThread::PostTaskAndReplyWithResult(
629 BrowserThread::IO, FROM_HERE, 629 BrowserThread::IO, FROM_HERE,
630 base::Bind(&Interceptor::Register, url_, 630 base::Bind(&Interceptor::Register, url_,
631 base::SequencedTaskRunnerHandle::Get()), 631 base::TaskRunnerHandle::GetSequenced()),
632 base::Bind(&StoreValueAndInvokeClosure<base::WeakPtr<Interceptor>>, 632 base::Bind(&StoreValueAndInvokeClosure<base::WeakPtr<Interceptor>>,
633 run_loop.QuitClosure(), &interceptor_)); 633 run_loop.QuitClosure(), &interceptor_));
634 run_loop.Run(); 634 run_loop.Run();
635 } 635 }
636 636
637 void TestDownloadRequestHandler::StartServing(const Parameters& parameters) { 637 void TestDownloadRequestHandler::StartServing(const Parameters& parameters) {
638 DCHECK(CalledOnValidThread()); 638 DCHECK(CalledOnValidThread());
639 Interceptor::JobFactory job_factory = 639 Interceptor::JobFactory job_factory =
640 base::Bind(&PartialResponseJob::Factory, parameters); 640 base::Bind(&PartialResponseJob::Factory, parameters);
641 // Interceptor, if valid, is already registered and serving requests. We just 641 // Interceptor, if valid, is already registered and serving requests. We just
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 base::RunLoop run_loop; 687 base::RunLoop run_loop;
688 BrowserThread::PostTaskAndReply( 688 BrowserThread::PostTaskAndReply(
689 BrowserThread::IO, FROM_HERE, 689 BrowserThread::IO, FROM_HERE,
690 base::Bind(&Interceptor::GetAndResetCompletedRequests, interceptor_, 690 base::Bind(&Interceptor::GetAndResetCompletedRequests, interceptor_,
691 requests), 691 requests),
692 run_loop.QuitClosure()); 692 run_loop.QuitClosure());
693 run_loop.Run(); 693 run_loop.Run();
694 } 694 }
695 695
696 } // namespace content 696 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/url_downloader.cc ('k') | tools/gn/bootstrap/bootstrap.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698