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

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

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 months 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/socket_test_util.cc ('k') | net/socket/ssl_server_socket_unittest.cc » ('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/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( 2315 scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket(
2316 transport.Pass(), test_server.host_port_pair(), SSLConfig())); 2316 transport.Pass(), test_server.host_port_pair(), SSLConfig()));
2317 2317
2318 rv = sock->Connect(callback.callback()); 2318 rv = sock->Connect(callback.callback());
2319 if (rv == ERR_IO_PENDING) 2319 if (rv == ERR_IO_PENDING)
2320 rv = callback.WaitForResult(); 2320 rv = callback.WaitForResult();
2321 EXPECT_EQ(OK, rv); 2321 EXPECT_EQ(OK, rv);
2322 EXPECT_TRUE(sock->IsConnected()); 2322 EXPECT_TRUE(sock->IsConnected());
2323 2323
2324 const int kKeyingMaterialSize = 32; 2324 const int kKeyingMaterialSize = 32;
2325 const char* kKeyingLabel1 = "client-socket-test-1"; 2325 const char kKeyingLabel1[] = "client-socket-test-1";
2326 const char* kKeyingContext = ""; 2326 const char kKeyingContext[] = "";
2327 unsigned char client_out1[kKeyingMaterialSize]; 2327 unsigned char client_out1[kKeyingMaterialSize];
2328 memset(client_out1, 0, sizeof(client_out1)); 2328 memset(client_out1, 0, sizeof(client_out1));
2329 rv = sock->ExportKeyingMaterial( 2329 rv = sock->ExportKeyingMaterial(
2330 kKeyingLabel1, false, kKeyingContext, client_out1, sizeof(client_out1)); 2330 kKeyingLabel1, false, kKeyingContext, client_out1, sizeof(client_out1));
2331 EXPECT_EQ(rv, OK); 2331 EXPECT_EQ(rv, OK);
2332 2332
2333 const char* kKeyingLabel2 = "client-socket-test-2"; 2333 const char kKeyingLabel2[] = "client-socket-test-2";
2334 unsigned char client_out2[kKeyingMaterialSize]; 2334 unsigned char client_out2[kKeyingMaterialSize];
2335 memset(client_out2, 0, sizeof(client_out2)); 2335 memset(client_out2, 0, sizeof(client_out2));
2336 rv = sock->ExportKeyingMaterial( 2336 rv = sock->ExportKeyingMaterial(
2337 kKeyingLabel2, false, kKeyingContext, client_out2, sizeof(client_out2)); 2337 kKeyingLabel2, false, kKeyingContext, client_out2, sizeof(client_out2));
2338 EXPECT_EQ(rv, OK); 2338 EXPECT_EQ(rv, OK);
2339 EXPECT_NE(memcmp(client_out1, client_out2, kKeyingMaterialSize), 0); 2339 EXPECT_NE(memcmp(client_out1, client_out2, kKeyingMaterialSize), 0);
2340 } 2340 }
2341 2341
2342 // Verifies that SSLClientSocket::ClearSessionCache can be called without 2342 // Verifies that SSLClientSocket::ClearSessionCache can be called without
2343 // explicit NSS initialization. 2343 // explicit NSS initialization.
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
3094 ssl_config.channel_id_enabled = true; 3094 ssl_config.channel_id_enabled = true;
3095 3095
3096 int rv; 3096 int rv;
3097 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); 3097 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv));
3098 3098
3099 EXPECT_EQ(ERR_UNEXPECTED, rv); 3099 EXPECT_EQ(ERR_UNEXPECTED, rv);
3100 EXPECT_FALSE(sock_->IsConnected()); 3100 EXPECT_FALSE(sock_->IsConnected());
3101 } 3101 }
3102 3102
3103 } // namespace net 3103 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socket_test_util.cc ('k') | net/socket/ssl_server_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698