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/fake_ssl_client_socket.h" | 5 #include "jingle/glue/fake_ssl_client_socket.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
| 18 #include "net/base/ip_address.h" |
18 #include "net/base/test_completion_callback.h" | 19 #include "net/base/test_completion_callback.h" |
19 #include "net/log/net_log.h" | 20 #include "net/log/net_log.h" |
20 #include "net/socket/socket_test_util.h" | 21 #include "net/socket/socket_test_util.h" |
21 #include "net/socket/stream_socket.h" | 22 #include "net/socket/stream_socket.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
24 | 25 |
25 namespace jingle_glue { | 26 namespace jingle_glue { |
26 | 27 |
27 namespace { | 28 namespace { |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 base::MessageLoop message_loop_; | 273 base::MessageLoop message_loop_; |
273 | 274 |
274 net::MockClientSocketFactory mock_client_socket_factory_; | 275 net::MockClientSocketFactory mock_client_socket_factory_; |
275 scoped_ptr<net::StaticSocketDataProvider> static_socket_data_provider_; | 276 scoped_ptr<net::StaticSocketDataProvider> static_socket_data_provider_; |
276 }; | 277 }; |
277 | 278 |
278 TEST_F(FakeSSLClientSocketTest, PassThroughMethods) { | 279 TEST_F(FakeSSLClientSocketTest, PassThroughMethods) { |
279 scoped_ptr<MockClientSocket> mock_client_socket(new MockClientSocket()); | 280 scoped_ptr<MockClientSocket> mock_client_socket(new MockClientSocket()); |
280 const int kReceiveBufferSize = 10; | 281 const int kReceiveBufferSize = 10; |
281 const int kSendBufferSize = 20; | 282 const int kSendBufferSize = 20; |
282 net::IPEndPoint ip_endpoint(net::IPAddressNumber(net::kIPv4AddressSize), 80); | 283 net::IPEndPoint ip_endpoint(net::IPAddress::IPv4AllZeros(), 80); |
283 const int kPeerAddress = 30; | 284 const int kPeerAddress = 30; |
284 net::BoundNetLog net_log; | 285 net::BoundNetLog net_log; |
285 EXPECT_CALL(*mock_client_socket, SetReceiveBufferSize(kReceiveBufferSize)); | 286 EXPECT_CALL(*mock_client_socket, SetReceiveBufferSize(kReceiveBufferSize)); |
286 EXPECT_CALL(*mock_client_socket, SetSendBufferSize(kSendBufferSize)); | 287 EXPECT_CALL(*mock_client_socket, SetSendBufferSize(kSendBufferSize)); |
287 EXPECT_CALL(*mock_client_socket, GetPeerAddress(&ip_endpoint)). | 288 EXPECT_CALL(*mock_client_socket, GetPeerAddress(&ip_endpoint)). |
288 WillOnce(Return(kPeerAddress)); | 289 WillOnce(Return(kPeerAddress)); |
289 EXPECT_CALL(*mock_client_socket, NetLog()).WillOnce(ReturnRef(net_log)); | 290 EXPECT_CALL(*mock_client_socket, NetLog()).WillOnce(ReturnRef(net_log)); |
290 EXPECT_CALL(*mock_client_socket, SetSubresourceSpeculation()); | 291 EXPECT_CALL(*mock_client_socket, SetSubresourceSpeculation()); |
291 EXPECT_CALL(*mock_client_socket, SetOmniboxSpeculation()); | 292 EXPECT_CALL(*mock_client_socket, SetOmniboxSpeculation()); |
292 | 293 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 } | 347 } |
347 | 348 |
348 TEST_F(FakeSSLClientSocketTest, MalformedServerHello) { | 349 TEST_F(FakeSSLClientSocketTest, MalformedServerHello) { |
349 RunUnsuccessfulHandshakeTest(ERR_MALFORMED_SERVER_HELLO, | 350 RunUnsuccessfulHandshakeTest(ERR_MALFORMED_SERVER_HELLO, |
350 VERIFY_SERVER_HELLO_ERROR); | 351 VERIFY_SERVER_HELLO_ERROR); |
351 } | 352 } |
352 | 353 |
353 } // namespace | 354 } // namespace |
354 | 355 |
355 } // namespace jingle_glue | 356 } // namespace jingle_glue |
OLD | NEW |