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

Unified Diff: net/url_request/url_request_data_job_fuzzer.cc

Issue 2697843002: Add ScopedTaskScheduler in URLRequestDataJobFuzzerHarness. (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_data_job_fuzzer.cc
diff --git a/net/url_request/url_request_data_job_fuzzer.cc b/net/url_request/url_request_data_job_fuzzer.cc
index 003edd5cb223e6221bd8432656b251992616c840..c244536e4eabca843e6e69207866528f78b67b8b 100644
--- a/net/url_request/url_request_data_job_fuzzer.cc
+++ b/net/url_request/url_request_data_job_fuzzer.cc
@@ -7,8 +7,10 @@
#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
+#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/test/fuzzed_data_provider.h"
+#include "base/test/scoped_task_scheduler.h"
#include "base/threading/thread_task_runner_handle.h"
#include "net/http/http_request_headers.h"
#include "net/url_request/data_protocol_handler.h"
@@ -29,7 +31,9 @@ const size_t kMaxLengthForFuzzedRange = 32;
class URLRequestDataJobFuzzerHarness : public net::URLRequest::Delegate {
public:
URLRequestDataJobFuzzerHarness()
- : context_(true), task_runner_(base::ThreadTaskRunnerHandle::Get()) {
+ : task_runner_(base::ThreadTaskRunnerHandle::Get()),
xunjieli 2017/02/14 17:51:59 Is the |task_runner_| still needed? Can you post t
fdoray 2017/02/14 18:24:30 In fact, we don't even need to post a task in Quit
+ scoped_task_scheduler_(base::MessageLoop::current()),
+ context_(true) {
job_factory_.SetProtocolHandler(
"data", base::MakeUnique<net::DataProtocolHandler>());
context_.set_job_factory(&job_factory_);
@@ -155,11 +159,13 @@ class URLRequestDataJobFuzzerHarness : public net::URLRequest::Delegate {
private:
friend struct base::DefaultSingletonTraits<URLRequestDataJobFuzzerHarness>;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ base::test::ScopedTaskScheduler scoped_task_scheduler_;
xunjieli 2017/02/14 16:17:37 The requirement that every subclass needs a Scoped
fdoray 2017/02/14 17:44:10 A TaskScheduler must be registered in the current
xunjieli 2017/02/14 17:51:59 Acknowledged.
+
net::TestURLRequestContext context_;
net::URLRequestJobFactoryImpl job_factory_;
std::vector<size_t> read_lengths_;
scoped_refptr<net::IOBuffer> buf_;
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
base::RunLoop* read_loop_;
DISALLOW_COPY_AND_ASSIGN(URLRequestDataJobFuzzerHarness);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698