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 "net/proxy/mock_proxy_resolver.h" | 7 #include "net/proxy/mock_proxy_resolver.h" |
8 #include "net/test/event_waiter.h" | 8 #include "net/test/event_waiter.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" | 10 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 void SetUp() override { | 39 void SetUp() override { |
40 new MojoProxyResolverFactoryImpl( | 40 new MojoProxyResolverFactoryImpl( |
41 base::Bind(&MojoProxyResolverFactoryImplTest::CreateFakeProxyResolver, | 41 base::Bind(&MojoProxyResolverFactoryImplTest::CreateFakeProxyResolver, |
42 base::Unretained(this)), | 42 base::Unretained(this)), |
43 mojo::GetProxy(&factory_)); | 43 mojo::GetProxy(&factory_)); |
44 } | 44 } |
45 | 45 |
46 void OnConnectionError() override { waiter_.NotifyEvent(CONNECTION_ERROR); } | 46 void OnConnectionError() override { waiter_.NotifyEvent(CONNECTION_ERROR); } |
47 | 47 |
48 scoped_ptr<ProxyResolver> CreateFakeProxyResolver( | 48 scoped_ptr<ProxyResolver> CreateFakeProxyResolver( |
49 HostResolver* host_resolver) { | 49 HostResolver* host_resolver, |
| 50 const ProxyResolver::LoadStateChangedCallback& callback) { |
50 EXPECT_TRUE(host_resolver); | 51 EXPECT_TRUE(host_resolver); |
51 instances_created_++; | 52 instances_created_++; |
52 waiter_.NotifyEvent(RESOLVER_CREATED); | 53 waiter_.NotifyEvent(RESOLVER_CREATED); |
53 return make_scoped_ptr(new FakeProxyResolver(base::Bind( | 54 return make_scoped_ptr(new FakeProxyResolver(base::Bind( |
54 &MojoProxyResolverFactoryImplTest::OnFakeProxyInstanceDestroyed, | 55 &MojoProxyResolverFactoryImplTest::OnFakeProxyInstanceDestroyed, |
55 base::Unretained(this)))); | 56 base::Unretained(this)))); |
56 } | 57 } |
57 | 58 |
58 void OnFakeProxyInstanceDestroyed() { | 59 void OnFakeProxyInstanceDestroyed() { |
59 instances_destroyed_++; | 60 instances_destroyed_++; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 EXPECT_EQ(1, instances_created_); | 115 EXPECT_EQ(1, instances_created_); |
115 EXPECT_EQ(0, instances_destroyed_); | 116 EXPECT_EQ(0, instances_destroyed_); |
116 proxy_resolver.reset(); | 117 proxy_resolver.reset(); |
117 host_resolver_request = mojo::InterfaceRequest<interfaces::HostResolver>(); | 118 host_resolver_request = mojo::InterfaceRequest<interfaces::HostResolver>(); |
118 waiter_.WaitForEvent(RESOLVER_DESTROYED); | 119 waiter_.WaitForEvent(RESOLVER_DESTROYED); |
119 EXPECT_EQ(1, instances_created_); | 120 EXPECT_EQ(1, instances_created_); |
120 EXPECT_EQ(1, instances_destroyed_); | 121 EXPECT_EQ(1, instances_destroyed_); |
121 } | 122 } |
122 | 123 |
123 } // namespace net | 124 } // namespace net |
OLD | NEW |