| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 15 matching lines...) Expand all Loading... |
| 26 #include "net/base/cert_status_flags.h" | 26 #include "net/base/cert_status_flags.h" |
| 27 #include "net/base/cert_verifier.h" | 27 #include "net/base/cert_verifier.h" |
| 28 #include "net/base/host_port_pair.h" | 28 #include "net/base/host_port_pair.h" |
| 29 #include "net/base/io_buffer.h" | 29 #include "net/base/io_buffer.h" |
| 30 #include "net/base/ip_endpoint.h" | 30 #include "net/base/ip_endpoint.h" |
| 31 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
| 32 #include "net/base/net_log.h" | 32 #include "net/base/net_log.h" |
| 33 #include "net/base/ssl_config_service.h" | 33 #include "net/base/ssl_config_service.h" |
| 34 #include "net/base/ssl_info.h" | 34 #include "net/base/ssl_info.h" |
| 35 #include "net/base/x509_certificate.h" | 35 #include "net/base/x509_certificate.h" |
| 36 #include "net/socket/client_socket.h" | |
| 37 #include "net/socket/client_socket_factory.h" | 36 #include "net/socket/client_socket_factory.h" |
| 38 #include "net/socket/socket_test_util.h" | 37 #include "net/socket/socket_test_util.h" |
| 39 #include "net/socket/ssl_client_socket.h" | 38 #include "net/socket/ssl_client_socket.h" |
| 39 #include "net/socket/stream_socket.h" |
| 40 #include "testing/gtest/include/gtest/gtest.h" | 40 #include "testing/gtest/include/gtest/gtest.h" |
| 41 #include "testing/platform_test.h" | 41 #include "testing/platform_test.h" |
| 42 | 42 |
| 43 namespace net { | 43 namespace net { |
| 44 | 44 |
| 45 namespace { | 45 namespace { |
| 46 | 46 |
| 47 class FakeDataChannel { | 47 class FakeDataChannel { |
| 48 public: | 48 public: |
| 49 FakeDataChannel() : read_callback_(NULL), read_buf_len_(0) { | 49 FakeDataChannel() : read_callback_(NULL), read_buf_len_(0) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 net::CompletionCallback* read_callback_; | 94 net::CompletionCallback* read_callback_; |
| 95 scoped_refptr<net::IOBuffer> read_buf_; | 95 scoped_refptr<net::IOBuffer> read_buf_; |
| 96 int read_buf_len_; | 96 int read_buf_len_; |
| 97 | 97 |
| 98 std::queue<scoped_refptr<net::DrainableIOBuffer> > data_; | 98 std::queue<scoped_refptr<net::DrainableIOBuffer> > data_; |
| 99 | 99 |
| 100 DISALLOW_COPY_AND_ASSIGN(FakeDataChannel); | 100 DISALLOW_COPY_AND_ASSIGN(FakeDataChannel); |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 class FakeSocket : public ClientSocket { | 103 class FakeSocket : public StreamSocket { |
| 104 public: | 104 public: |
| 105 FakeSocket(FakeDataChannel* incoming_channel, | 105 FakeSocket(FakeDataChannel* incoming_channel, |
| 106 FakeDataChannel* outgoing_channel) | 106 FakeDataChannel* outgoing_channel) |
| 107 : incoming_(incoming_channel), | 107 : incoming_(incoming_channel), |
| 108 outgoing_(outgoing_channel) { | 108 outgoing_(outgoing_channel) { |
| 109 } | 109 } |
| 110 | 110 |
| 111 virtual ~FakeSocket() { | 111 virtual ~FakeSocket() { |
| 112 | 112 |
| 113 } | 113 } |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 EXPECT_GT(read_callback.WaitForResult(), 0); | 366 EXPECT_GT(read_callback.WaitForResult(), 0); |
| 367 } | 367 } |
| 368 if (client_ret == net::ERR_IO_PENDING) { | 368 if (client_ret == net::ERR_IO_PENDING) { |
| 369 EXPECT_GT(write_callback.WaitForResult(), 0); | 369 EXPECT_GT(write_callback.WaitForResult(), 0); |
| 370 } | 370 } |
| 371 EXPECT_EQ(0, memcmp(write_buf->data(), read_buf->data(), write_buf->size())); | 371 EXPECT_EQ(0, memcmp(write_buf->data(), read_buf->data(), write_buf->size())); |
| 372 } | 372 } |
| 373 #endif | 373 #endif |
| 374 | 374 |
| 375 } // namespace net | 375 } // namespace net |
| OLD | NEW |