| 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 | 9 |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 class ProxyServiceMojoTest : public testing::Test, | 122 class ProxyServiceMojoTest : public testing::Test, |
| 123 public MojoProxyResolverFactory { | 123 public MojoProxyResolverFactory { |
| 124 protected: | 124 protected: |
| 125 void SetUp() override { | 125 void SetUp() override { |
| 126 mock_host_resolver_.rules()->AddRule("example.com", "1.2.3.4"); | 126 mock_host_resolver_.rules()->AddRule("example.com", "1.2.3.4"); |
| 127 | 127 |
| 128 fetcher_ = new MockProxyScriptFetcher; | 128 fetcher_ = new MockProxyScriptFetcher; |
| 129 proxy_service_.reset(CreateProxyServiceUsingMojoFactory( | 129 proxy_service_.reset(CreateProxyServiceUsingMojoFactory( |
| 130 this, new ProxyConfigServiceFixed( | 130 this, new ProxyConfigServiceFixed( |
| 131 ProxyConfig::CreateFromCustomPacURL(GURL(kPacUrl))), | 131 ProxyConfig::CreateFromCustomPacURL(GURL(kPacUrl))), |
| 132 fetcher_, new DoNothingDhcpProxyScriptFetcher(), &mock_host_resolver_, | 132 fetcher_, scoped_ptr<DhcpProxyScriptFetcher>( |
| 133 &net_log_, &network_delegate_)); | 133 new DoNothingDhcpProxyScriptFetcher()), |
| 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, req.Pass(), client.Pass()); |
| 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())); |
| (...skipping 109 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 |