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 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 MOCK_METHOD3(Write, int(net::IOBuffer*, int, | 56 MOCK_METHOD3(Write, int(net::IOBuffer*, int, |
57 const net::CompletionCallback&)); | 57 const net::CompletionCallback&)); |
58 MOCK_METHOD1(SetReceiveBufferSize, int(int32_t)); | 58 MOCK_METHOD1(SetReceiveBufferSize, int(int32_t)); |
59 MOCK_METHOD1(SetSendBufferSize, int(int32_t)); | 59 MOCK_METHOD1(SetSendBufferSize, int(int32_t)); |
60 MOCK_METHOD1(Connect, int(const net::CompletionCallback&)); | 60 MOCK_METHOD1(Connect, int(const net::CompletionCallback&)); |
61 MOCK_METHOD0(Disconnect, void()); | 61 MOCK_METHOD0(Disconnect, void()); |
62 MOCK_CONST_METHOD0(IsConnected, bool()); | 62 MOCK_CONST_METHOD0(IsConnected, bool()); |
63 MOCK_CONST_METHOD0(IsConnectedAndIdle, bool()); | 63 MOCK_CONST_METHOD0(IsConnectedAndIdle, bool()); |
64 MOCK_CONST_METHOD1(GetPeerAddress, int(net::IPEndPoint*)); | 64 MOCK_CONST_METHOD1(GetPeerAddress, int(net::IPEndPoint*)); |
65 MOCK_CONST_METHOD1(GetLocalAddress, int(net::IPEndPoint*)); | 65 MOCK_CONST_METHOD1(GetLocalAddress, int(net::IPEndPoint*)); |
66 MOCK_CONST_METHOD0(NetLog, const net::BoundNetLog&()); | 66 MOCK_CONST_METHOD0(NetLog, const net::NetLogWithSource&()); |
67 MOCK_METHOD0(SetSubresourceSpeculation, void()); | 67 MOCK_METHOD0(SetSubresourceSpeculation, void()); |
68 MOCK_METHOD0(SetOmniboxSpeculation, void()); | 68 MOCK_METHOD0(SetOmniboxSpeculation, void()); |
69 MOCK_CONST_METHOD0(WasEverUsed, bool()); | 69 MOCK_CONST_METHOD0(WasEverUsed, bool()); |
70 MOCK_CONST_METHOD0(UsingTCPFastOpen, bool()); | 70 MOCK_CONST_METHOD0(UsingTCPFastOpen, bool()); |
71 MOCK_CONST_METHOD0(NumBytesRead, int64_t()); | 71 MOCK_CONST_METHOD0(NumBytesRead, int64_t()); |
72 MOCK_CONST_METHOD0(GetConnectTimeMicros, base::TimeDelta()); | 72 MOCK_CONST_METHOD0(GetConnectTimeMicros, base::TimeDelta()); |
73 MOCK_CONST_METHOD0(WasNpnNegotiated, bool()); | 73 MOCK_CONST_METHOD0(WasNpnNegotiated, bool()); |
74 MOCK_CONST_METHOD0(GetNegotiatedProtocol, net::NextProto()); | 74 MOCK_CONST_METHOD0(GetNegotiatedProtocol, net::NextProto()); |
75 MOCK_METHOD1(GetSSLInfo, bool(net::SSLInfo*)); | 75 MOCK_METHOD1(GetSSLInfo, bool(net::SSLInfo*)); |
76 MOCK_CONST_METHOD1(GetConnectionAttempts, void(net::ConnectionAttempts*)); | 76 MOCK_CONST_METHOD1(GetConnectionAttempts, void(net::ConnectionAttempts*)); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 net::MockClientSocketFactory mock_client_socket_factory_; | 276 net::MockClientSocketFactory mock_client_socket_factory_; |
277 std::unique_ptr<net::StaticSocketDataProvider> static_socket_data_provider_; | 277 std::unique_ptr<net::StaticSocketDataProvider> static_socket_data_provider_; |
278 }; | 278 }; |
279 | 279 |
280 TEST_F(FakeSSLClientSocketTest, PassThroughMethods) { | 280 TEST_F(FakeSSLClientSocketTest, PassThroughMethods) { |
281 std::unique_ptr<MockClientSocket> mock_client_socket(new MockClientSocket()); | 281 std::unique_ptr<MockClientSocket> mock_client_socket(new MockClientSocket()); |
282 const int kReceiveBufferSize = 10; | 282 const int kReceiveBufferSize = 10; |
283 const int kSendBufferSize = 20; | 283 const int kSendBufferSize = 20; |
284 net::IPEndPoint ip_endpoint(net::IPAddress::IPv4AllZeros(), 80); | 284 net::IPEndPoint ip_endpoint(net::IPAddress::IPv4AllZeros(), 80); |
285 const int kPeerAddress = 30; | 285 const int kPeerAddress = 30; |
286 net::BoundNetLog net_log; | 286 net::NetLogWithSource net_log; |
287 EXPECT_CALL(*mock_client_socket, SetReceiveBufferSize(kReceiveBufferSize)); | 287 EXPECT_CALL(*mock_client_socket, SetReceiveBufferSize(kReceiveBufferSize)); |
288 EXPECT_CALL(*mock_client_socket, SetSendBufferSize(kSendBufferSize)); | 288 EXPECT_CALL(*mock_client_socket, SetSendBufferSize(kSendBufferSize)); |
289 EXPECT_CALL(*mock_client_socket, GetPeerAddress(&ip_endpoint)). | 289 EXPECT_CALL(*mock_client_socket, GetPeerAddress(&ip_endpoint)). |
290 WillOnce(Return(kPeerAddress)); | 290 WillOnce(Return(kPeerAddress)); |
291 EXPECT_CALL(*mock_client_socket, NetLog()).WillOnce(ReturnRef(net_log)); | 291 EXPECT_CALL(*mock_client_socket, NetLog()).WillOnce(ReturnRef(net_log)); |
292 EXPECT_CALL(*mock_client_socket, SetSubresourceSpeculation()); | 292 EXPECT_CALL(*mock_client_socket, SetSubresourceSpeculation()); |
293 EXPECT_CALL(*mock_client_socket, SetOmniboxSpeculation()); | 293 EXPECT_CALL(*mock_client_socket, SetOmniboxSpeculation()); |
294 | 294 |
295 // Takes ownership of |mock_client_socket|. | 295 // Takes ownership of |mock_client_socket|. |
296 FakeSSLClientSocket fake_ssl_client_socket(std::move(mock_client_socket)); | 296 FakeSSLClientSocket fake_ssl_client_socket(std::move(mock_client_socket)); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 } | 348 } |
349 | 349 |
350 TEST_F(FakeSSLClientSocketTest, MalformedServerHello) { | 350 TEST_F(FakeSSLClientSocketTest, MalformedServerHello) { |
351 RunUnsuccessfulHandshakeTest(ERR_MALFORMED_SERVER_HELLO, | 351 RunUnsuccessfulHandshakeTest(ERR_MALFORMED_SERVER_HELLO, |
352 VERIFY_SERVER_HELLO_ERROR); | 352 VERIFY_SERVER_HELLO_ERROR); |
353 } | 353 } |
354 | 354 |
355 } // namespace | 355 } // namespace |
356 | 356 |
357 } // namespace jingle_glue | 357 } // namespace jingle_glue |
OLD | NEW |