| Index: net/http/http_network_transaction_unittest.cc
|
| diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
|
| index 7c68c3fe34308990f16a0529f1a942477f69ac16..754bd99a08032149e6ab676df42e4884d75377c2 100644
|
| --- a/net/http/http_network_transaction_unittest.cc
|
| +++ b/net/http/http_network_transaction_unittest.cc
|
| @@ -72,7 +72,6 @@
|
| #include "net/proxy/proxy_config_service_fixed.h"
|
| #include "net/proxy/proxy_info.h"
|
| #include "net/proxy/proxy_resolver.h"
|
| -#include "net/proxy/proxy_resolver_factory.h"
|
| #include "net/proxy/proxy_server.h"
|
| #include "net/proxy/proxy_service.h"
|
| #include "net/socket/client_socket_factory.h"
|
| @@ -379,20 +378,6 @@ std::unique_ptr<HttpNetworkSession> CreateSessionWithThrottler(
|
| return session;
|
| }
|
|
|
| -class FailingProxyResolverFactory : public ProxyResolverFactory {
|
| - public:
|
| - FailingProxyResolverFactory() : ProxyResolverFactory(false) {}
|
| -
|
| - // ProxyResolverFactory override.
|
| - int CreateProxyResolver(
|
| - const scoped_refptr<ProxyResolverScriptData>& script_data,
|
| - std::unique_ptr<ProxyResolver>* result,
|
| - const CompletionCallback& callback,
|
| - std::unique_ptr<Request>* request) override {
|
| - return ERR_PAC_SCRIPT_FAILED;
|
| - }
|
| -};
|
| -
|
| } // namespace
|
|
|
| class HttpNetworkTransactionTest : public PlatformTest {
|
| @@ -15224,21 +15209,20 @@ class FakeStreamFactory : public HttpStreamFactory {
|
| return last_stream_request_;
|
| }
|
|
|
| - std::unique_ptr<HttpStreamRequest> RequestStream(
|
| - const HttpRequestInfo& info,
|
| - RequestPriority priority,
|
| - const SSLConfig& server_ssl_config,
|
| - const SSLConfig& proxy_ssl_config,
|
| - HttpStreamRequest::Delegate* delegate,
|
| - bool enable_ip_based_pooling,
|
| - bool enable_alternative_services,
|
| - const NetLogWithSource& net_log) override {
|
| - auto fake_request = base::MakeUnique<FakeStreamRequest>(priority, delegate);
|
| + HttpStreamRequest* RequestStream(const HttpRequestInfo& info,
|
| + RequestPriority priority,
|
| + const SSLConfig& server_ssl_config,
|
| + const SSLConfig& proxy_ssl_config,
|
| + HttpStreamRequest::Delegate* delegate,
|
| + bool enable_ip_based_pooling,
|
| + bool enable_alternative_services,
|
| + const NetLogWithSource& net_log) override {
|
| + FakeStreamRequest* fake_request = new FakeStreamRequest(priority, delegate);
|
| last_stream_request_ = fake_request->AsWeakPtr();
|
| - return std::move(fake_request);
|
| + return fake_request;
|
| }
|
|
|
| - std::unique_ptr<HttpStreamRequest> RequestBidirectionalStreamImpl(
|
| + HttpStreamRequest* RequestBidirectionalStreamImpl(
|
| const HttpRequestInfo& info,
|
| RequestPriority priority,
|
| const SSLConfig& server_ssl_config,
|
| @@ -15251,7 +15235,7 @@ class FakeStreamFactory : public HttpStreamFactory {
|
| return nullptr;
|
| }
|
|
|
| - std::unique_ptr<HttpStreamRequest> RequestWebSocketHandshakeStream(
|
| + HttpStreamRequest* RequestWebSocketHandshakeStream(
|
| const HttpRequestInfo& info,
|
| RequestPriority priority,
|
| const SSLConfig& server_ssl_config,
|
| @@ -15261,10 +15245,10 @@ class FakeStreamFactory : public HttpStreamFactory {
|
| bool enable_ip_based_pooling,
|
| bool enable_alternative_services,
|
| const NetLogWithSource& net_log) override {
|
| - auto fake_request =
|
| - base::MakeUnique<FakeStreamRequest>(priority, delegate, create_helper);
|
| + FakeStreamRequest* fake_request =
|
| + new FakeStreamRequest(priority, delegate, create_helper);
|
| last_stream_request_ = fake_request->AsWeakPtr();
|
| - return std::move(fake_request);
|
| + return fake_request;
|
| }
|
|
|
| void PreconnectStreams(int num_streams,
|
| @@ -16877,73 +16861,4 @@ TEST_F(HttpNetworkTransactionTest, MatchContentEncoding4) {
|
| "www.foo.com/other", true);
|
| }
|
|
|
| -TEST_F(HttpNetworkTransactionTest, ProxyResolutionFailsSync) {
|
| - ProxyConfig proxy_config;
|
| - proxy_config.set_pac_url(GURL("http://fooproxyurl"));
|
| - proxy_config.set_pac_mandatory(true);
|
| - MockAsyncProxyResolver resolver;
|
| - session_deps_.proxy_service.reset(new ProxyService(
|
| - base::MakeUnique<ProxyConfigServiceFixed>(proxy_config),
|
| - base::WrapUnique(new FailingProxyResolverFactory), nullptr));
|
| -
|
| - HttpRequestInfo request;
|
| - request.method = "GET";
|
| - request.url = GURL("http://www.example.org/");
|
| -
|
| - std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_));
|
| - HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get());
|
| -
|
| - TestCompletionCallback callback;
|
| -
|
| - int rv = trans.Start(&request, callback.callback(), NetLogWithSource());
|
| - EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
|
| - EXPECT_THAT(callback.WaitForResult(),
|
| - IsError(ERR_MANDATORY_PROXY_CONFIGURATION_FAILED));
|
| -}
|
| -
|
| -TEST_F(HttpNetworkTransactionTest, ProxyResolutionFailsAsync) {
|
| - ProxyConfig proxy_config;
|
| - proxy_config.set_pac_url(GURL("http://fooproxyurl"));
|
| - proxy_config.set_pac_mandatory(true);
|
| - MockAsyncProxyResolverFactory* proxy_resolver_factory =
|
| - new MockAsyncProxyResolverFactory(false);
|
| - MockAsyncProxyResolver resolver;
|
| - session_deps_.proxy_service.reset(
|
| - new ProxyService(base::MakeUnique<ProxyConfigServiceFixed>(proxy_config),
|
| - base::WrapUnique(proxy_resolver_factory), nullptr));
|
| - HttpRequestInfo request;
|
| - request.method = "GET";
|
| - request.url = GURL("http://www.example.org/");
|
| -
|
| - std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_));
|
| - HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get());
|
| -
|
| - TestCompletionCallback callback;
|
| - int rv = trans.Start(&request, callback.callback(), NetLogWithSource());
|
| - EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
|
| -
|
| - proxy_resolver_factory->pending_requests()[0]->CompleteNowWithForwarder(
|
| - ERR_FAILED, &resolver);
|
| - EXPECT_THAT(callback.WaitForResult(),
|
| - IsError(ERR_MANDATORY_PROXY_CONFIGURATION_FAILED));
|
| -}
|
| -
|
| -TEST_F(HttpNetworkTransactionTest, NoSupportedProxies) {
|
| - session_deps_.proxy_service =
|
| - ProxyService::CreateFixedFromPacResult("QUIC myproxy.org:443");
|
| - session_deps_.enable_quic = false;
|
| - std::unique_ptr<HttpNetworkSession> session(CreateSession(&session_deps_));
|
| -
|
| - HttpRequestInfo request;
|
| - request.method = "GET";
|
| - request.url = GURL("http://www.example.org/");
|
| -
|
| - TestCompletionCallback callback;
|
| - HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get());
|
| - int rv = trans.Start(&request, callback.callback(), NetLogWithSource());
|
| - EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
|
| -
|
| - EXPECT_THAT(callback.WaitForResult(), IsError(ERR_NO_SUPPORTED_PROXIES));
|
| -}
|
| -
|
| } // namespace net
|
|
|