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

Side by Side Diff: net/url_request/url_request_context_builder_unittest.cc

Issue 2679233003: Use TaskScheduler instead of WorkerPool in polling_proxy_config_service.cc. (Closed)
Patch Set: private 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 unified diff | Download patch
« no previous file with comments | « net/proxy/polling_proxy_config_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/url_request/url_request_context_builder.h" 5 #include "net/url_request/url_request_context_builder.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/test/scoped_task_scheduler.h"
11 #include "build/build_config.h" 13 #include "build/build_config.h"
12 #include "net/base/request_priority.h" 14 #include "net/base/request_priority.h"
13 #include "net/http/http_auth_challenge_tokenizer.h" 15 #include "net/http/http_auth_challenge_tokenizer.h"
14 #include "net/http/http_auth_handler.h" 16 #include "net/http/http_auth_handler.h"
15 #include "net/http/http_auth_handler_factory.h" 17 #include "net/http/http_auth_handler_factory.h"
16 #include "net/log/net_log_with_source.h" 18 #include "net/log/net_log_with_source.h"
17 #include "net/ssl/ssl_info.h" 19 #include "net/ssl/ssl_info.h"
18 #include "net/test/embedded_test_server/embedded_test_server.h" 20 #include "net/test/embedded_test_server/embedded_test_server.h"
19 #include "net/url_request/url_request.h" 21 #include "net/url_request/url_request.h"
20 #include "net/url_request/url_request_test_util.h" 22 #include "net/url_request/url_request_test_util.h"
(...skipping 30 matching lines...) Expand all
51 : ERR_UNSUPPORTED_AUTH_SCHEME; 53 : ERR_UNSUPPORTED_AUTH_SCHEME;
52 } 54 }
53 55
54 private: 56 private:
55 int return_code_; 57 int return_code_;
56 std::string supported_scheme_; 58 std::string supported_scheme_;
57 }; 59 };
58 60
59 class URLRequestContextBuilderTest : public PlatformTest { 61 class URLRequestContextBuilderTest : public PlatformTest {
60 protected: 62 protected:
61 URLRequestContextBuilderTest() { 63 URLRequestContextBuilderTest()
64 : scoped_task_scheduler_(base::MessageLoop::current()) {
62 test_server_.AddDefaultHandlers( 65 test_server_.AddDefaultHandlers(
63 base::FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))); 66 base::FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest")));
64 #if defined(OS_LINUX) || defined(OS_ANDROID) 67 #if defined(OS_LINUX) || defined(OS_ANDROID)
65 builder_.set_proxy_config_service( 68 builder_.set_proxy_config_service(
66 base::MakeUnique<ProxyConfigServiceFixed>(ProxyConfig::CreateDirect())); 69 base::MakeUnique<ProxyConfigServiceFixed>(ProxyConfig::CreateDirect()));
67 #endif // defined(OS_LINUX) || defined(OS_ANDROID) 70 #endif // defined(OS_LINUX) || defined(OS_ANDROID)
68 } 71 }
69 72
70 EmbeddedTestServer test_server_; 73 EmbeddedTestServer test_server_;
71 URLRequestContextBuilder builder_; 74 URLRequestContextBuilder builder_;
75
76 private:
77 base::test::ScopedTaskScheduler scoped_task_scheduler_;
eroman 2017/02/13 23:14:52 Same question that I asked on this code review (ht
fdoray 2017/02/16 21:41:00 1. Upload a patch set. 2. Send it to the CQ dry ru
eroman 2017/02/16 22:14:02 Thanks for the explanation. This pattern still fe
72 }; 78 };
73 79
74 TEST_F(URLRequestContextBuilderTest, DefaultSettings) { 80 TEST_F(URLRequestContextBuilderTest, DefaultSettings) {
75 ASSERT_TRUE(test_server_.Start()); 81 ASSERT_TRUE(test_server_.Start());
76 82
77 std::unique_ptr<URLRequestContext> context(builder_.Build()); 83 std::unique_ptr<URLRequestContext> context(builder_.Build());
78 TestDelegate delegate; 84 TestDelegate delegate;
79 std::unique_ptr<URLRequest> request(context->CreateRequest( 85 std::unique_ptr<URLRequest> request(context->CreateRequest(
80 test_server_.GetURL("/echoheader?Foo"), DEFAULT_PRIORITY, &delegate)); 86 test_server_.GetURL("/echoheader?Foo"), DEFAULT_PRIORITY, &delegate));
81 request->set_method("GET"); 87 request->set_method("GET");
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // Verify that a handler isn't returned for a bogus scheme. 143 // Verify that a handler isn't returned for a bogus scheme.
138 EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, 144 EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME,
139 context->http_auth_handler_factory()->CreateAuthHandlerFromString( 145 context->http_auth_handler_factory()->CreateAuthHandlerFromString(
140 "Bogus", HttpAuth::AUTH_SERVER, null_ssl_info, gurl, 146 "Bogus", HttpAuth::AUTH_SERVER, null_ssl_info, gurl,
141 NetLogWithSource(), &handler)); 147 NetLogWithSource(), &handler));
142 } 148 }
143 149
144 } // namespace 150 } // namespace
145 151
146 } // namespace net 152 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/polling_proxy_config_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698