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 <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 if (mode == net::ASYNC) { | 157 if (mode == net::ASYNC) { |
158 EXPECT_FALSE(fake_ssl_client_socket.IsConnected()); | 158 EXPECT_FALSE(fake_ssl_client_socket.IsConnected()); |
159 } | 159 } |
160 ExpectStatus(mode, net::OK, status, &test_completion_callback); | 160 ExpectStatus(mode, net::OK, status, &test_completion_callback); |
161 if (fake_ssl_client_socket.IsConnected()) { | 161 if (fake_ssl_client_socket.IsConnected()) { |
162 int read_len = arraysize(kReadTestData); | 162 int read_len = arraysize(kReadTestData); |
163 int read_buf_len = 2 * read_len; | 163 int read_buf_len = 2 * read_len; |
164 scoped_refptr<net::IOBuffer> read_buf( | 164 scoped_refptr<net::IOBuffer> read_buf( |
165 new net::IOBuffer(read_buf_len)); | 165 new net::IOBuffer(read_buf_len)); |
166 int read_status = fake_ssl_client_socket.Read( | 166 int read_status = fake_ssl_client_socket.Read( |
167 read_buf, read_buf_len, test_completion_callback.callback()); | 167 read_buf.get(), read_buf_len, test_completion_callback.callback()); |
168 ExpectStatus(mode, read_len, read_status, &test_completion_callback); | 168 ExpectStatus(mode, read_len, read_status, &test_completion_callback); |
169 | 169 |
170 scoped_refptr<net::IOBuffer> write_buf( | 170 scoped_refptr<net::IOBuffer> write_buf( |
171 new net::StringIOBuffer(kWriteTestData)); | 171 new net::StringIOBuffer(kWriteTestData)); |
172 int write_status = fake_ssl_client_socket.Write( | 172 int write_status = |
173 write_buf, arraysize(kWriteTestData), | 173 fake_ssl_client_socket.Write(write_buf.get(), |
174 test_completion_callback.callback()); | 174 arraysize(kWriteTestData), |
| 175 test_completion_callback.callback()); |
175 ExpectStatus(mode, arraysize(kWriteTestData), write_status, | 176 ExpectStatus(mode, arraysize(kWriteTestData), write_status, |
176 &test_completion_callback); | 177 &test_completion_callback); |
177 } else { | 178 } else { |
178 ADD_FAILURE(); | 179 ADD_FAILURE(); |
179 } | 180 } |
180 fake_ssl_client_socket.Disconnect(); | 181 fake_ssl_client_socket.Disconnect(); |
181 EXPECT_FALSE(fake_ssl_client_socket.IsConnected()); | 182 EXPECT_FALSE(fake_ssl_client_socket.IsConnected()); |
182 } | 183 } |
183 } | 184 } |
184 | 185 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 } | 339 } |
339 | 340 |
340 TEST_F(FakeSSLClientSocketTest, MalformedServerHello) { | 341 TEST_F(FakeSSLClientSocketTest, MalformedServerHello) { |
341 RunUnsuccessfulHandshakeTest(ERR_MALFORMED_SERVER_HELLO, | 342 RunUnsuccessfulHandshakeTest(ERR_MALFORMED_SERVER_HELLO, |
342 VERIFY_SERVER_HELLO_ERROR); | 343 VERIFY_SERVER_HELLO_ERROR); |
343 } | 344 } |
344 | 345 |
345 } // namespace | 346 } // namespace |
346 | 347 |
347 } // namespace jingle_glue | 348 } // namespace jingle_glue |
OLD | NEW |