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