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

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

Issue 2034663003: Remove use of deprecated MessageLoop methods in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
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/logging.h" 13 #include "base/logging.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
16 #include "base/run_loop.h" 17 #include "base/run_loop.h"
17 #include "base/sequenced_task_runner.h" 18 #include "base/sequenced_task_runner.h"
19 #include "base/single_thread_task_runner.h"
18 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
19 #include "base/threading/sequenced_task_runner_handle.h" 21 #include "base/threading/sequenced_task_runner_handle.h"
22 #include "base/threading/thread_task_runner_handle.h"
20 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
21 #include "net/base/io_buffer.h" 24 #include "net/base/io_buffer.h"
22 #include "net/http/http_request_headers.h" 25 #include "net/http/http_request_headers.h"
23 #include "net/http/http_response_headers.h" 26 #include "net/http/http_response_headers.h"
24 #include "net/url_request/url_request_filter.h" 27 #include "net/url_request/url_request_filter.h"
25 #include "net/url_request/url_request_interceptor.h" 28 #include "net/url_request/url_request_interceptor.h"
26 29
27 namespace content { 30 namespace content {
28 31
29 // Intercepts URLRequests on behalf of TestDownloadRequestHandler. Necessarily 32 // Intercepts URLRequests on behalf of TestDownloadRequestHandler. Necessarily
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // prevents injecting an error at offset 0, it makes it much easier to set up 486 // prevents injecting an error at offset 0, it makes it much easier to set up
484 // parameter sets for download resumption. It means that when a request is 487 // parameter sets for download resumption. It means that when a request is
485 // interrupted at offset O, a subsequent request for the range O-<end> won't 488 // interrupted at offset O, a subsequent request for the range O-<end> won't
486 // immediately interrupt as well. If we don't exclude interruptions at 489 // immediately interrupt as well. If we don't exclude interruptions at
487 // relative offset 0, then test writers would need to reset the parameter 490 // relative offset 0, then test writers would need to reset the parameter
488 // prior to each resumption rather than once at the beginning of the test. 491 // prior to each resumption rather than once at the beginning of the test.
489 while (!parameters_->injected_errors.empty() && 492 while (!parameters_->injected_errors.empty() &&
490 parameters_->injected_errors.front().offset <= requested_range_begin_) 493 parameters_->injected_errors.front().offset <= requested_range_begin_)
491 parameters_->injected_errors.pop(); 494 parameters_->injected_errors.pop();
492 495
493 base::MessageLoop::current()->PostTask( 496 base::ThreadTaskRunnerHandle::Get()->PostTask(
494 FROM_HERE, base::Bind(&PartialResponseJob::NotifyHeadersComplete, 497 FROM_HERE, base::Bind(&PartialResponseJob::NotifyHeadersComplete,
495 weak_factory_.GetWeakPtr())); 498 weak_factory_.GetWeakPtr()));
496 } 499 }
497 500
498 // static 501 // static
499 base::WeakPtr<TestDownloadRequestHandler::Interceptor> 502 base::WeakPtr<TestDownloadRequestHandler::Interceptor>
500 TestDownloadRequestHandler::Interceptor::Register( 503 TestDownloadRequestHandler::Interceptor::Register(
501 const GURL& url, 504 const GURL& url,
502 scoped_refptr<base::SequencedTaskRunner> client_task_runner) { 505 scoped_refptr<base::SequencedTaskRunner> client_task_runner) {
503 DCHECK(url.is_valid()); 506 DCHECK(url.is_valid());
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 base::RunLoop run_loop; 687 base::RunLoop run_loop;
685 BrowserThread::PostTaskAndReply( 688 BrowserThread::PostTaskAndReply(
686 BrowserThread::IO, FROM_HERE, 689 BrowserThread::IO, FROM_HERE,
687 base::Bind(&Interceptor::GetAndResetCompletedRequests, interceptor_, 690 base::Bind(&Interceptor::GetAndResetCompletedRequests, interceptor_,
688 requests), 691 requests),
689 run_loop.QuitClosure()); 692 run_loop.QuitClosure());
690 run_loop.Run(); 693 run_loop.Run();
691 } 694 }
692 695
693 } // namespace content 696 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/mock_render_process_host.cc ('k') | content/renderer/android/synchronous_compositor_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698