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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 2602243002: Use TaskScheduler instead of WorkerPool in multi_threaded_cert_verifier.cc. (Closed)
Patch Set: self-review 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
Index: net/url_request/url_request_unittest.cc
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index dd2b713221128b79adb22cab2624b552cc6bca7e..d6b507fc516d36ec83cea9ccd2254f1408e199b9 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -43,6 +43,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/histogram_tester.h"
+#include "base/test/scoped_async_task_scheduler.h"
#include "base/test/scoped_task_scheduler.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
@@ -771,7 +772,9 @@ class OCSPErrorTestDelegate : public TestDelegate {
// Inherit PlatformTest since we require the autorelease pool on Mac OS X.
class URLRequestTest : public PlatformTest {
public:
- URLRequestTest() : default_context_(true) {
+ URLRequestTest()
+ : scoped_task_scheduler_(base::MessageLoop::current()),
+ default_context_(true) {
default_context_.set_network_delegate(&default_network_delegate_);
default_context_.set_net_log(&net_log_);
job_factory_impl_ = new URLRequestJobFactoryImpl();
@@ -819,6 +822,8 @@ class URLRequestTest : public PlatformTest {
}
protected:
+ // Required by ChannelIDService and MultiThreadedCertVerifier.
+ base::test::ScopedTaskScheduler scoped_task_scheduler_;
TestNetLog net_log_;
TestNetworkDelegate default_network_delegate_; // Must outlive URLRequest.
URLRequestJobFactoryImpl* job_factory_impl_;
@@ -3444,8 +3449,7 @@ class TestSSLConfigService : public SSLConfigService {
#if !defined(OS_IOS)
class TokenBindingURLRequestTest : public URLRequestTestHTTP {
public:
- TokenBindingURLRequestTest()
- : scoped_task_scheduler_(base::MessageLoop::current()) {}
+ TokenBindingURLRequestTest() = default;
void SetUp() override {
default_context_.set_ssl_config_service(
@@ -3457,8 +3461,6 @@ class TokenBindingURLRequestTest : public URLRequestTestHTTP {
}
protected:
- // Required by ChannelIDService.
- base::test::ScopedTaskScheduler scoped_task_scheduler_;
std::unique_ptr<ChannelIDService> channel_id_service_;
};
@@ -8537,17 +8539,20 @@ TEST_F(URLRequestTestReferrerPolicy, HTTPSToHTTP) {
class HTTPSRequestTest : public testing::Test {
public:
- HTTPSRequestTest()
- : scoped_task_scheduler_(base::MessageLoop::current()),
- default_context_(true) {
+ HTTPSRequestTest() : default_context_(true) {
default_context_.set_network_delegate(&default_network_delegate_);
default_context_.Init();
}
~HTTPSRequestTest() override {}
protected:
- // Required by ChannelIDService.
- base::test::ScopedTaskScheduler scoped_task_scheduler_;
+ // Required by ChannelIDService and MultiThreadedCertVerifier. Needs to be a
+ // ScopedAsyncTaskScheduler rather than a ScopedTaskScheduler because the task
+ // posted by MultiThreadedCertVerifier synchronously waits for a task running
+ // on the main thread (OCSPRequestSession::Wait).
+ base::test::ScopedAsyncTaskScheduler scoped_async_task_scheduler_;
+
+ protected:
TestNetworkDelegate default_network_delegate_; // Must outlive URLRequest.
TestURLRequestContext default_context_;
};

Powered by Google App Engine
This is Rietveld 408576698