Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Side by Side Diff: net/socket/ssl_client_socket_unittest.cc

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/ssl_client_socket_pool.cc ('k') | net/socket/ssl_server_socket.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/socket/ssl_client_socket.h" 5 #include "net/socket/ssl_client_socket.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
10 #include "base/run_loop.h" 11 #include "base/run_loop.h"
11 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
12 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
13 #include "base/time/time.h" 14 #include "base/time/time.h"
14 #include "net/base/address_list.h" 15 #include "net/base/address_list.h"
15 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
16 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
17 #include "net/base/test_completion_callback.h" 18 #include "net/base/test_completion_callback.h"
18 #include "net/base/test_data_directory.h" 19 #include "net/base/test_data_directory.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 int Read(IOBuffer* buf, 114 int Read(IOBuffer* buf,
114 int buf_len, 115 int buf_len,
115 const CompletionCallback& callback) override { 116 const CompletionCallback& callback) override {
116 return transport_->Read(buf, buf_len, callback); 117 return transport_->Read(buf, buf_len, callback);
117 } 118 }
118 int Write(IOBuffer* buf, 119 int Write(IOBuffer* buf,
119 int buf_len, 120 int buf_len,
120 const CompletionCallback& callback) override { 121 const CompletionCallback& callback) override {
121 return transport_->Write(buf, buf_len, callback); 122 return transport_->Write(buf, buf_len, callback);
122 } 123 }
123 int SetReceiveBufferSize(int32 size) override { 124 int SetReceiveBufferSize(int32_t size) override {
124 return transport_->SetReceiveBufferSize(size); 125 return transport_->SetReceiveBufferSize(size);
125 } 126 }
126 int SetSendBufferSize(int32 size) override { 127 int SetSendBufferSize(int32_t size) override {
127 return transport_->SetSendBufferSize(size); 128 return transport_->SetSendBufferSize(size);
128 } 129 }
129 130
130 protected: 131 protected:
131 scoped_ptr<StreamSocket> transport_; 132 scoped_ptr<StreamSocket> transport_;
132 }; 133 };
133 134
134 // ReadBufferingStreamSocket is a wrapper for an existing StreamSocket that 135 // ReadBufferingStreamSocket is a wrapper for an existing StreamSocket that
135 // will ensure a certain amount of data is internally buffered before 136 // will ensure a certain amount of data is internally buffered before
136 // satisfying a Read() request. It exists to mimic OS-level internal 137 // satisfying a Read() request. It exists to mimic OS-level internal
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 transport.Pass(), spawned_test_server()->host_port_pair(), SSLConfig())); 1911 transport.Pass(), spawned_test_server()->host_port_pair(), SSLConfig()));
1911 1912
1912 rv = callback.GetResult(sock->Connect(callback.callback())); 1913 rv = callback.GetResult(sock->Connect(callback.callback()));
1913 EXPECT_EQ(ERR_SSL_PROTOCOL_ERROR, rv); 1914 EXPECT_EQ(ERR_SSL_PROTOCOL_ERROR, rv);
1914 } 1915 }
1915 1916
1916 TEST_F(SSLClientSocketTest, CipherSuiteDisables) { 1917 TEST_F(SSLClientSocketTest, CipherSuiteDisables) {
1917 // Rather than exhaustively disabling every AES_128_CBC ciphersuite defined at 1918 // Rather than exhaustively disabling every AES_128_CBC ciphersuite defined at
1918 // http://www.iana.org/assignments/tls-parameters/tls-parameters.xml, only 1919 // http://www.iana.org/assignments/tls-parameters/tls-parameters.xml, only
1919 // disabling those cipher suites that the test server actually implements. 1920 // disabling those cipher suites that the test server actually implements.
1920 const uint16 kCiphersToDisable[] = { 1921 const uint16_t kCiphersToDisable[] = {
1921 0x002f, // TLS_RSA_WITH_AES_128_CBC_SHA 1922 0x002f, // TLS_RSA_WITH_AES_128_CBC_SHA
1922 0x0033, // TLS_DHE_RSA_WITH_AES_128_CBC_SHA 1923 0x0033, // TLS_DHE_RSA_WITH_AES_128_CBC_SHA
1923 0xc013, // TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 1924 0xc013, // TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
1924 }; 1925 };
1925 1926
1926 SpawnedTestServer::SSLOptions ssl_options; 1927 SpawnedTestServer::SSLOptions ssl_options;
1927 // Enable only AES_128_CBC on the test server. 1928 // Enable only AES_128_CBC on the test server.
1928 ssl_options.bulk_ciphers = SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128; 1929 ssl_options.bulk_ciphers = SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128;
1929 ASSERT_TRUE(StartTestServer(ssl_options)); 1930 ASSERT_TRUE(StartTestServer(ssl_options));
1930 1931
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
3214 int rv; 3215 int rv;
3215 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv)); 3216 ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
3216 EXPECT_EQ(OK, rv); 3217 EXPECT_EQ(OK, rv);
3217 3218
3218 std::string proto; 3219 std::string proto;
3219 EXPECT_EQ(SSLClientSocket::kNextProtoUnsupported, 3220 EXPECT_EQ(SSLClientSocket::kNextProtoUnsupported,
3220 sock_->GetNextProto(&proto)); 3221 sock_->GetNextProto(&proto));
3221 } 3222 }
3222 3223
3223 } // namespace net 3224 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_pool.cc ('k') | net/socket/ssl_server_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698