| 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 | |
| 10 #include <algorithm> | 9 #include <algorithm> |
| 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/test_completion_callback.h" | 18 #include "net/base/test_completion_callback.h" |
| 19 #include "net/log/net_log.h" | 19 #include "net/log/net_log.h" |
| 20 #include "net/socket/socket_test_util.h" | 20 #include "net/socket/socket_test_util.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 net::BoundNetLog net_log; | 284 net::BoundNetLog net_log; |
| 285 EXPECT_CALL(*mock_client_socket, SetReceiveBufferSize(kReceiveBufferSize)); | 285 EXPECT_CALL(*mock_client_socket, SetReceiveBufferSize(kReceiveBufferSize)); |
| 286 EXPECT_CALL(*mock_client_socket, SetSendBufferSize(kSendBufferSize)); | 286 EXPECT_CALL(*mock_client_socket, SetSendBufferSize(kSendBufferSize)); |
| 287 EXPECT_CALL(*mock_client_socket, GetPeerAddress(&ip_endpoint)). | 287 EXPECT_CALL(*mock_client_socket, GetPeerAddress(&ip_endpoint)). |
| 288 WillOnce(Return(kPeerAddress)); | 288 WillOnce(Return(kPeerAddress)); |
| 289 EXPECT_CALL(*mock_client_socket, NetLog()).WillOnce(ReturnRef(net_log)); | 289 EXPECT_CALL(*mock_client_socket, NetLog()).WillOnce(ReturnRef(net_log)); |
| 290 EXPECT_CALL(*mock_client_socket, SetSubresourceSpeculation()); | 290 EXPECT_CALL(*mock_client_socket, SetSubresourceSpeculation()); |
| 291 EXPECT_CALL(*mock_client_socket, SetOmniboxSpeculation()); | 291 EXPECT_CALL(*mock_client_socket, SetOmniboxSpeculation()); |
| 292 | 292 |
| 293 // Takes ownership of |mock_client_socket|. | 293 // Takes ownership of |mock_client_socket|. |
| 294 FakeSSLClientSocket fake_ssl_client_socket(mock_client_socket.Pass()); | 294 FakeSSLClientSocket fake_ssl_client_socket(std::move(mock_client_socket)); |
| 295 fake_ssl_client_socket.SetReceiveBufferSize(kReceiveBufferSize); | 295 fake_ssl_client_socket.SetReceiveBufferSize(kReceiveBufferSize); |
| 296 fake_ssl_client_socket.SetSendBufferSize(kSendBufferSize); | 296 fake_ssl_client_socket.SetSendBufferSize(kSendBufferSize); |
| 297 EXPECT_EQ(kPeerAddress, | 297 EXPECT_EQ(kPeerAddress, |
| 298 fake_ssl_client_socket.GetPeerAddress(&ip_endpoint)); | 298 fake_ssl_client_socket.GetPeerAddress(&ip_endpoint)); |
| 299 EXPECT_EQ(&net_log, &fake_ssl_client_socket.NetLog()); | 299 EXPECT_EQ(&net_log, &fake_ssl_client_socket.NetLog()); |
| 300 fake_ssl_client_socket.SetSubresourceSpeculation(); | 300 fake_ssl_client_socket.SetSubresourceSpeculation(); |
| 301 fake_ssl_client_socket.SetOmniboxSpeculation(); | 301 fake_ssl_client_socket.SetOmniboxSpeculation(); |
| 302 } | 302 } |
| 303 | 303 |
| 304 TEST_F(FakeSSLClientSocketTest, SuccessfulHandshakeSync) { | 304 TEST_F(FakeSSLClientSocketTest, SuccessfulHandshakeSync) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 } | 346 } |
| 347 | 347 |
| 348 TEST_F(FakeSSLClientSocketTest, MalformedServerHello) { | 348 TEST_F(FakeSSLClientSocketTest, MalformedServerHello) { |
| 349 RunUnsuccessfulHandshakeTest(ERR_MALFORMED_SERVER_HELLO, | 349 RunUnsuccessfulHandshakeTest(ERR_MALFORMED_SERVER_HELLO, |
| 350 VERIFY_SERVER_HELLO_ERROR); | 350 VERIFY_SERVER_HELLO_ERROR); |
| 351 } | 351 } |
| 352 | 352 |
| 353 } // namespace | 353 } // namespace |
| 354 | 354 |
| 355 } // namespace jingle_glue | 355 } // namespace jingle_glue |
| OLD | NEW |