| 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/mojo_proxy_resolver_factory_impl.h" | 5 #include "net/proxy/mojo_proxy_resolver_factory_impl.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "net/base/test_completion_callback.h" | 8 #include "net/base/test_completion_callback.h" |
| 9 #include "net/proxy/mock_proxy_resolver.h" | 9 #include "net/proxy/mock_proxy_resolver.h" |
| 10 #include "net/proxy/proxy_resolver_v8_tracing.h" | 10 #include "net/proxy/proxy_resolver_v8_tracing.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 explicit FakeProxyResolver(const base::Closure& on_destruction) | 22 explicit FakeProxyResolver(const base::Closure& on_destruction) |
| 23 : on_destruction_(on_destruction) {} | 23 : on_destruction_(on_destruction) {} |
| 24 | 24 |
| 25 ~FakeProxyResolver() override { on_destruction_.Run(); } | 25 ~FakeProxyResolver() override { on_destruction_.Run(); } |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 // ProxyResolverV8Tracing overrides. | 28 // ProxyResolverV8Tracing overrides. |
| 29 void GetProxyForURL(const GURL& url, | 29 void GetProxyForURL(const GURL& url, |
| 30 ProxyInfo* results, | 30 ProxyInfo* results, |
| 31 const CompletionCallback& callback, | 31 const CompletionCallback& callback, |
| 32 ProxyResolver::RequestHandle* request, | 32 scoped_ptr<ProxyResolver::Request>* request, |
| 33 scoped_ptr<Bindings> bindings) override {} | 33 scoped_ptr<Bindings> bindings) override {} |
| 34 | 34 |
| 35 void CancelRequest(ProxyResolver::RequestHandle request) override {} | |
| 36 | |
| 37 LoadState GetLoadState(ProxyResolver::RequestHandle request) const override { | |
| 38 return LOAD_STATE_RESOLVING_PROXY_FOR_URL; | |
| 39 } | |
| 40 | |
| 41 const base::Closure on_destruction_; | 35 const base::Closure on_destruction_; |
| 42 }; | 36 }; |
| 43 | 37 |
| 44 enum Event { | 38 enum Event { |
| 45 NONE, | 39 NONE, |
| 46 RESOLVER_CREATED, | 40 RESOLVER_CREATED, |
| 47 CONNECTION_ERROR, | 41 CONNECTION_ERROR, |
| 48 RESOLVER_DESTROYED, | 42 RESOLVER_DESTROYED, |
| 49 }; | 43 }; |
| 50 | 44 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError, | 201 base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError, |
| 208 base::Unretained(this))); | 202 base::Unretained(this))); |
| 209 waiter_.WaitForEvent(RESOLVER_CREATED); | 203 waiter_.WaitForEvent(RESOLVER_CREATED); |
| 210 EXPECT_EQ(0, instances_destroyed_); | 204 EXPECT_EQ(0, instances_destroyed_); |
| 211 ASSERT_EQ(1u, mock_factory_->requests_handled()); | 205 ASSERT_EQ(1u, mock_factory_->requests_handled()); |
| 212 factory_.reset(); | 206 factory_.reset(); |
| 213 waiter_.WaitForEvent(CONNECTION_ERROR); | 207 waiter_.WaitForEvent(CONNECTION_ERROR); |
| 214 } | 208 } |
| 215 | 209 |
| 216 } // namespace net | 210 } // namespace net |
| OLD | NEW |