| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <utility> | 12 #include <utility> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 18 #include "net/base/io_buffer.h" | 18 #include "net/base/io_buffer.h" |
| 19 #include "net/base/ip_address.h" | 19 #include "net/base/ip_address.h" |
| 20 #include "net/base/test_completion_callback.h" | 20 #include "net/base/test_completion_callback.h" |
| 21 #include "net/log/net_log.h" | 21 #include "net/log/net_log_source.h" |
| 22 #include "net/log/net_log_with_source.h" |
| 22 #include "net/socket/socket_test_util.h" | 23 #include "net/socket/socket_test_util.h" |
| 23 #include "net/socket/stream_socket.h" | 24 #include "net/socket/stream_socket.h" |
| 24 #include "testing/gmock/include/gmock/gmock.h" | 25 #include "testing/gmock/include/gmock/gmock.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 27 |
| 27 namespace jingle_glue { | 28 namespace jingle_glue { |
| 28 | 29 |
| 29 namespace { | 30 namespace { |
| 30 | 31 |
| 31 using ::testing::Return; | 32 using ::testing::Return; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 96 } |
| 96 | 97 |
| 97 class FakeSSLClientSocketTest : public testing::Test { | 98 class FakeSSLClientSocketTest : public testing::Test { |
| 98 protected: | 99 protected: |
| 99 FakeSSLClientSocketTest() {} | 100 FakeSSLClientSocketTest() {} |
| 100 | 101 |
| 101 ~FakeSSLClientSocketTest() override {} | 102 ~FakeSSLClientSocketTest() override {} |
| 102 | 103 |
| 103 std::unique_ptr<net::StreamSocket> MakeClientSocket() { | 104 std::unique_ptr<net::StreamSocket> MakeClientSocket() { |
| 104 return mock_client_socket_factory_.CreateTransportClientSocket( | 105 return mock_client_socket_factory_.CreateTransportClientSocket( |
| 105 net::AddressList(), NULL, NULL, net::NetLog::Source()); | 106 net::AddressList(), NULL, NULL, net::NetLogSource()); |
| 106 } | 107 } |
| 107 | 108 |
| 108 void SetData(const net::MockConnect& mock_connect, | 109 void SetData(const net::MockConnect& mock_connect, |
| 109 std::vector<net::MockRead>* reads, | 110 std::vector<net::MockRead>* reads, |
| 110 std::vector<net::MockWrite>* writes) { | 111 std::vector<net::MockWrite>* writes) { |
| 111 static_socket_data_provider_.reset( | 112 static_socket_data_provider_.reset( |
| 112 new net::StaticSocketDataProvider( | 113 new net::StaticSocketDataProvider( |
| 113 reads->empty() ? NULL : &*reads->begin(), reads->size(), | 114 reads->empty() ? NULL : &*reads->begin(), reads->size(), |
| 114 writes->empty() ? NULL : &*writes->begin(), writes->size())); | 115 writes->empty() ? NULL : &*writes->begin(), writes->size())); |
| 115 static_socket_data_provider_->set_connect_data(mock_connect); | 116 static_socket_data_provider_->set_connect_data(mock_connect); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 349 } |
| 349 | 350 |
| 350 TEST_F(FakeSSLClientSocketTest, MalformedServerHello) { | 351 TEST_F(FakeSSLClientSocketTest, MalformedServerHello) { |
| 351 RunUnsuccessfulHandshakeTest(ERR_MALFORMED_SERVER_HELLO, | 352 RunUnsuccessfulHandshakeTest(ERR_MALFORMED_SERVER_HELLO, |
| 352 VERIFY_SERVER_HELLO_ERROR); | 353 VERIFY_SERVER_HELLO_ERROR); |
| 353 } | 354 } |
| 354 | 355 |
| 355 } // namespace | 356 } // namespace |
| 356 | 357 |
| 357 } // namespace jingle_glue | 358 } // namespace jingle_glue |
| OLD | NEW |