OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "jingle/glue/chrome_async_socket.h" | 5 #include "jingle/glue/chrome_async_socket.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/message_loop/message_pump_default.h" | 16 #include "base/message_loop/message_pump_default.h" |
17 #include "jingle/glue/resolving_client_socket_factory.h" | 17 #include "jingle/glue/resolving_client_socket_factory.h" |
18 #include "net/base/address_list.h" | 18 #include "net/base/address_list.h" |
| 19 #include "net/base/ip_address.h" |
19 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
20 #include "net/cert/mock_cert_verifier.h" | 21 #include "net/cert/mock_cert_verifier.h" |
21 #include "net/http/transport_security_state.h" | 22 #include "net/http/transport_security_state.h" |
22 #include "net/socket/socket_test_util.h" | 23 #include "net/socket/socket_test_util.h" |
23 #include "net/socket/ssl_client_socket.h" | 24 #include "net/socket/ssl_client_socket.h" |
24 #include "net/ssl/ssl_config_service.h" | 25 #include "net/ssl/ssl_config_service.h" |
25 #include "net/url_request/url_request_context_getter.h" | 26 #include "net/url_request/url_request_context_getter.h" |
26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
27 #include "third_party/webrtc/base/ipaddress.h" | 28 #include "third_party/webrtc/base/ipaddress.h" |
28 #include "third_party/webrtc/base/sigslot.h" | 29 #include "third_party/webrtc/base/sigslot.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 168 |
168 void SetUp() override { | 169 void SetUp() override { |
169 scoped_ptr<net::MockClientSocketFactory> mock_client_socket_factory( | 170 scoped_ptr<net::MockClientSocketFactory> mock_client_socket_factory( |
170 new net::MockClientSocketFactory()); | 171 new net::MockClientSocketFactory()); |
171 mock_client_socket_factory->AddSocketDataProvider( | 172 mock_client_socket_factory->AddSocketDataProvider( |
172 &async_socket_data_provider_); | 173 &async_socket_data_provider_); |
173 mock_client_socket_factory->AddSSLSocketDataProvider( | 174 mock_client_socket_factory->AddSSLSocketDataProvider( |
174 &ssl_socket_data_provider_); | 175 &ssl_socket_data_provider_); |
175 | 176 |
176 // Fake DNS resolution for |addr_| and pass it to the factory. | 177 // Fake DNS resolution for |addr_| and pass it to the factory. |
177 net::IPAddressNumber resolved_addr; | 178 const net::AddressList address_list = net::AddressList::CreateFromIPAddress( |
178 EXPECT_TRUE(net::ParseIPLiteralToNumber("127.0.0.1", &resolved_addr)); | 179 net::IPAddress::IPv4Localhost(), addr_.port()); |
179 const net::AddressList address_list = | |
180 net::AddressList::CreateFromIPAddress(resolved_addr, addr_.port()); | |
181 scoped_ptr<MockXmppClientSocketFactory> mock_xmpp_client_socket_factory( | 180 scoped_ptr<MockXmppClientSocketFactory> mock_xmpp_client_socket_factory( |
182 new MockXmppClientSocketFactory( | 181 new MockXmppClientSocketFactory( |
183 mock_client_socket_factory.release(), | 182 mock_client_socket_factory.release(), |
184 address_list)); | 183 address_list)); |
185 chrome_async_socket_.reset( | 184 chrome_async_socket_.reset( |
186 new ChromeAsyncSocket(mock_xmpp_client_socket_factory.release(), | 185 new ChromeAsyncSocket(mock_xmpp_client_socket_factory.release(), |
187 14, 20)), | 186 14, 20)), |
188 | 187 |
189 chrome_async_socket_->SignalConnected.connect( | 188 chrome_async_socket_->SignalConnected.connect( |
190 this, &ChromeAsyncSocketTest::OnConnect); | 189 this, &ChromeAsyncSocketTest::OnConnect); |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 message_loop_->RunUntilIdle(); | 1091 message_loop_->RunUntilIdle(); |
1093 | 1092 |
1094 ExpectNoSignal(); | 1093 ExpectNoSignal(); |
1095 | 1094 |
1096 DoSSLCloseOpenedNoError(); | 1095 DoSSLCloseOpenedNoError(); |
1097 } | 1096 } |
1098 | 1097 |
1099 } // namespace | 1098 } // namespace |
1100 | 1099 |
1101 } // namespace jingle_glue | 1100 } // namespace jingle_glue |
OLD | NEW |