| 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 // This test suite uses SSLClientSocket to test the implementation of | 5 // This test suite uses SSLClientSocket to test the implementation of |
| 6 // SSLServerSocket. In order to establish connections between the sockets | 6 // SSLServerSocket. In order to establish connections between the sockets |
| 7 // we need two additional classes: | 7 // we need two additional classes: |
| 8 // 1. FakeSocket | 8 // 1. FakeSocket |
| 9 // Connects SSL socket to FakeDataChannel. This class is just a stub. | 9 // Connects SSL socket to FakeDataChannel. This class is just a stub. |
| 10 // | 10 // |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include <openssl/x509.h> | 25 #include <openssl/x509.h> |
| 26 | 26 |
| 27 #include "base/callback_helpers.h" | 27 #include "base/callback_helpers.h" |
| 28 #include "base/compiler_specific.h" | 28 #include "base/compiler_specific.h" |
| 29 #include "base/files/file_path.h" | 29 #include "base/files/file_path.h" |
| 30 #include "base/files/file_util.h" | 30 #include "base/files/file_util.h" |
| 31 #include "base/location.h" | 31 #include "base/location.h" |
| 32 #include "base/logging.h" | 32 #include "base/logging.h" |
| 33 #include "base/macros.h" | 33 #include "base/macros.h" |
| 34 #include "base/message_loop/message_loop.h" | 34 #include "base/message_loop/message_loop.h" |
| 35 #include "base/run_loop.h" |
| 35 #include "base/single_thread_task_runner.h" | 36 #include "base/single_thread_task_runner.h" |
| 36 #include "base/threading/thread_task_runner_handle.h" | 37 #include "base/threading/thread_task_runner_handle.h" |
| 37 #include "build/build_config.h" | 38 #include "build/build_config.h" |
| 38 #include "crypto/nss_util.h" | 39 #include "crypto/nss_util.h" |
| 39 #include "crypto/rsa_private_key.h" | 40 #include "crypto/rsa_private_key.h" |
| 40 #include "crypto/scoped_openssl_types.h" | 41 #include "crypto/scoped_openssl_types.h" |
| 41 #include "crypto/signature_creator.h" | 42 #include "crypto/signature_creator.h" |
| 42 #include "net/base/address_list.h" | 43 #include "net/base/address_list.h" |
| 43 #include "net/base/completion_callback.h" | 44 #include "net/base/completion_callback.h" |
| 44 #include "net/base/host_port_pair.h" | 45 #include "net/base/host_port_pair.h" |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 client_ret = client_socket_->Write(write_buf.get(), write_buf->size(), | 1027 client_ret = client_socket_->Write(write_buf.get(), write_buf->size(), |
| 1027 write_callback.callback()); | 1028 write_callback.callback()); |
| 1028 EXPECT_TRUE(client_ret > 0 || client_ret == ERR_IO_PENDING); | 1029 EXPECT_TRUE(client_ret > 0 || client_ret == ERR_IO_PENDING); |
| 1029 | 1030 |
| 1030 client_ret = write_callback.GetResult(client_ret); | 1031 client_ret = write_callback.GetResult(client_ret); |
| 1031 EXPECT_GT(client_ret, 0); | 1032 EXPECT_GT(client_ret, 0); |
| 1032 | 1033 |
| 1033 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1034 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 1034 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 1035 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
| 1035 base::TimeDelta::FromMilliseconds(10)); | 1036 base::TimeDelta::FromMilliseconds(10)); |
| 1036 base::MessageLoop::current()->Run(); | 1037 base::RunLoop().Run(); |
| 1037 } | 1038 } |
| 1038 | 1039 |
| 1039 // This test executes ExportKeyingMaterial() on the client and server sockets, | 1040 // This test executes ExportKeyingMaterial() on the client and server sockets, |
| 1040 // after connecting them, and verifies that the results match. | 1041 // after connecting them, and verifies that the results match. |
| 1041 // This test will fail if False Start is enabled (see crbug.com/90208). | 1042 // This test will fail if False Start is enabled (see crbug.com/90208). |
| 1042 TEST_F(SSLServerSocketTest, ExportKeyingMaterial) { | 1043 TEST_F(SSLServerSocketTest, ExportKeyingMaterial) { |
| 1043 ASSERT_NO_FATAL_FAILURE(CreateContext()); | 1044 ASSERT_NO_FATAL_FAILURE(CreateContext()); |
| 1044 ASSERT_NO_FATAL_FAILURE(CreateSockets()); | 1045 ASSERT_NO_FATAL_FAILURE(CreateSockets()); |
| 1045 | 1046 |
| 1046 TestCompletionCallback connect_callback; | 1047 TestCompletionCallback connect_callback; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 int server_ret = server_socket_->Handshake(handshake_callback.callback()); | 1112 int server_ret = server_socket_->Handshake(handshake_callback.callback()); |
| 1112 | 1113 |
| 1113 client_ret = connect_callback.GetResult(client_ret); | 1114 client_ret = connect_callback.GetResult(client_ret); |
| 1114 server_ret = handshake_callback.GetResult(server_ret); | 1115 server_ret = handshake_callback.GetResult(server_ret); |
| 1115 | 1116 |
| 1116 ASSERT_EQ(ERR_SSL_VERSION_OR_CIPHER_MISMATCH, client_ret); | 1117 ASSERT_EQ(ERR_SSL_VERSION_OR_CIPHER_MISMATCH, client_ret); |
| 1117 ASSERT_EQ(ERR_SSL_VERSION_OR_CIPHER_MISMATCH, server_ret); | 1118 ASSERT_EQ(ERR_SSL_VERSION_OR_CIPHER_MISMATCH, server_ret); |
| 1118 } | 1119 } |
| 1119 | 1120 |
| 1120 } // namespace net | 1121 } // namespace net |
| OLD | NEW |