OLD | NEW |
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 "net/proxy/proxy_service_mojo.h" | 5 #include "net/proxy/proxy_service_mojo.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
| 9 #include <utility> |
9 | 10 |
10 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "net/base/load_flags.h" | 15 #include "net/base/load_flags.h" |
15 #include "net/base/network_delegate_impl.h" | 16 #include "net/base/network_delegate_impl.h" |
16 #include "net/base/test_completion_callback.h" | 17 #include "net/base/test_completion_callback.h" |
17 #include "net/dns/mock_host_resolver.h" | 18 #include "net/dns/mock_host_resolver.h" |
18 #include "net/log/net_log.h" | 19 #include "net/log/net_log.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 ProxyConfig::CreateFromCustomPacURL(GURL(kPacUrl)))), | 132 ProxyConfig::CreateFromCustomPacURL(GURL(kPacUrl)))), |
132 fetcher_, make_scoped_ptr(new DoNothingDhcpProxyScriptFetcher()), | 133 fetcher_, make_scoped_ptr(new DoNothingDhcpProxyScriptFetcher()), |
133 &mock_host_resolver_, &net_log_, &network_delegate_); | 134 &mock_host_resolver_, &net_log_, &network_delegate_); |
134 } | 135 } |
135 | 136 |
136 scoped_ptr<base::ScopedClosureRunner> CreateResolver( | 137 scoped_ptr<base::ScopedClosureRunner> CreateResolver( |
137 const mojo::String& pac_script, | 138 const mojo::String& pac_script, |
138 mojo::InterfaceRequest<interfaces::ProxyResolver> req, | 139 mojo::InterfaceRequest<interfaces::ProxyResolver> req, |
139 interfaces::ProxyResolverFactoryRequestClientPtr client) override { | 140 interfaces::ProxyResolverFactoryRequestClientPtr client) override { |
140 InProcessMojoProxyResolverFactory::GetInstance()->CreateResolver( | 141 InProcessMojoProxyResolverFactory::GetInstance()->CreateResolver( |
141 pac_script, req.Pass(), client.Pass()); | 142 pac_script, std::move(req), std::move(client)); |
142 return make_scoped_ptr( | 143 return make_scoped_ptr( |
143 new base::ScopedClosureRunner(on_delete_closure_.closure())); | 144 new base::ScopedClosureRunner(on_delete_closure_.closure())); |
144 } | 145 } |
145 | 146 |
146 TestNetworkDelegate network_delegate_; | 147 TestNetworkDelegate network_delegate_; |
147 LoggingMockHostResolver mock_host_resolver_; | 148 LoggingMockHostResolver mock_host_resolver_; |
148 MockProxyScriptFetcher* fetcher_; // Owned by |proxy_service_|. | 149 MockProxyScriptFetcher* fetcher_; // Owned by |proxy_service_|. |
149 TestNetLog net_log_; | 150 TestNetLog net_log_; |
150 TestClosure on_delete_closure_; | 151 TestClosure on_delete_closure_; |
151 scoped_ptr<ProxyService> proxy_service_; | 152 scoped_ptr<ProxyService> proxy_service_; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 EXPECT_EQ(OK, callback.WaitForResult()); | 254 EXPECT_EQ(OK, callback.WaitForResult()); |
254 EXPECT_EQ("DIRECT", info.ToPacString()); | 255 EXPECT_EQ("DIRECT", info.ToPacString()); |
255 EXPECT_EQ(0u, mock_host_resolver_.num_resolve()); | 256 EXPECT_EQ(0u, mock_host_resolver_.num_resolve()); |
256 | 257 |
257 TestNetLogEntry::List entries; | 258 TestNetLogEntry::List entries; |
258 net_log_.GetEntries(&entries); | 259 net_log_.GetEntries(&entries); |
259 CheckCapturedNetLogEntries(entries); | 260 CheckCapturedNetLogEntries(entries); |
260 } | 261 } |
261 | 262 |
262 } // namespace net | 263 } // namespace net |
OLD | NEW |