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 <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 net::BoundNetLog net_log; | 277 net::BoundNetLog net_log; |
278 EXPECT_CALL(*mock_client_socket, SetReceiveBufferSize(kReceiveBufferSize)); | 278 EXPECT_CALL(*mock_client_socket, SetReceiveBufferSize(kReceiveBufferSize)); |
279 EXPECT_CALL(*mock_client_socket, SetSendBufferSize(kSendBufferSize)); | 279 EXPECT_CALL(*mock_client_socket, SetSendBufferSize(kSendBufferSize)); |
280 EXPECT_CALL(*mock_client_socket, GetPeerAddress(&ip_endpoint)). | 280 EXPECT_CALL(*mock_client_socket, GetPeerAddress(&ip_endpoint)). |
281 WillOnce(Return(kPeerAddress)); | 281 WillOnce(Return(kPeerAddress)); |
282 EXPECT_CALL(*mock_client_socket, NetLog()).WillOnce(ReturnRef(net_log)); | 282 EXPECT_CALL(*mock_client_socket, NetLog()).WillOnce(ReturnRef(net_log)); |
283 EXPECT_CALL(*mock_client_socket, SetSubresourceSpeculation()); | 283 EXPECT_CALL(*mock_client_socket, SetSubresourceSpeculation()); |
284 EXPECT_CALL(*mock_client_socket, SetOmniboxSpeculation()); | 284 EXPECT_CALL(*mock_client_socket, SetOmniboxSpeculation()); |
285 | 285 |
286 // Takes ownership of |mock_client_socket|. | 286 // Takes ownership of |mock_client_socket|. |
287 FakeSSLClientSocket fake_ssl_client_socket( | 287 FakeSSLClientSocket fake_ssl_client_socket(mock_client_socket.Pass()); |
288 mock_client_socket.PassAs<net::StreamSocket>()); | |
289 fake_ssl_client_socket.SetReceiveBufferSize(kReceiveBufferSize); | 288 fake_ssl_client_socket.SetReceiveBufferSize(kReceiveBufferSize); |
290 fake_ssl_client_socket.SetSendBufferSize(kSendBufferSize); | 289 fake_ssl_client_socket.SetSendBufferSize(kSendBufferSize); |
291 EXPECT_EQ(kPeerAddress, | 290 EXPECT_EQ(kPeerAddress, |
292 fake_ssl_client_socket.GetPeerAddress(&ip_endpoint)); | 291 fake_ssl_client_socket.GetPeerAddress(&ip_endpoint)); |
293 EXPECT_EQ(&net_log, &fake_ssl_client_socket.NetLog()); | 292 EXPECT_EQ(&net_log, &fake_ssl_client_socket.NetLog()); |
294 fake_ssl_client_socket.SetSubresourceSpeculation(); | 293 fake_ssl_client_socket.SetSubresourceSpeculation(); |
295 fake_ssl_client_socket.SetOmniboxSpeculation(); | 294 fake_ssl_client_socket.SetOmniboxSpeculation(); |
296 } | 295 } |
297 | 296 |
298 TEST_F(FakeSSLClientSocketTest, SuccessfulHandshakeSync) { | 297 TEST_F(FakeSSLClientSocketTest, SuccessfulHandshakeSync) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 } | 339 } |
341 | 340 |
342 TEST_F(FakeSSLClientSocketTest, MalformedServerHello) { | 341 TEST_F(FakeSSLClientSocketTest, MalformedServerHello) { |
343 RunUnsuccessfulHandshakeTest(ERR_MALFORMED_SERVER_HELLO, | 342 RunUnsuccessfulHandshakeTest(ERR_MALFORMED_SERVER_HELLO, |
344 VERIFY_SERVER_HELLO_ERROR); | 343 VERIFY_SERVER_HELLO_ERROR); |
345 } | 344 } |
346 | 345 |
347 } // namespace | 346 } // namespace |
348 | 347 |
349 } // namespace jingle_glue | 348 } // namespace jingle_glue |
OLD | NEW |