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

Side by Side Diff: net/socket/ssl_server_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/ssl_client_socket_unittest.cc ('k') | net/socket/websocket_endpoint_lock_manager.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 // 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 ASSERT_TRUE(server_ret == OK || server_ret == ERR_IO_PENDING); 528 ASSERT_TRUE(server_ret == OK || server_ret == ERR_IO_PENDING);
529 529
530 if (client_ret == ERR_IO_PENDING) { 530 if (client_ret == ERR_IO_PENDING) {
531 ASSERT_EQ(OK, connect_callback.WaitForResult()); 531 ASSERT_EQ(OK, connect_callback.WaitForResult());
532 } 532 }
533 if (server_ret == ERR_IO_PENDING) { 533 if (server_ret == ERR_IO_PENDING) {
534 ASSERT_EQ(OK, handshake_callback.WaitForResult()); 534 ASSERT_EQ(OK, handshake_callback.WaitForResult());
535 } 535 }
536 536
537 const int kKeyingMaterialSize = 32; 537 const int kKeyingMaterialSize = 32;
538 const char* kKeyingLabel = "EXPERIMENTAL-server-socket-test"; 538 const char kKeyingLabel[] = "EXPERIMENTAL-server-socket-test";
539 const char* kKeyingContext = ""; 539 const char kKeyingContext[] = "";
540 unsigned char server_out[kKeyingMaterialSize]; 540 unsigned char server_out[kKeyingMaterialSize];
541 int rv = server_socket_->ExportKeyingMaterial(kKeyingLabel, 541 int rv = server_socket_->ExportKeyingMaterial(kKeyingLabel,
542 false, kKeyingContext, 542 false, kKeyingContext,
543 server_out, sizeof(server_out)); 543 server_out, sizeof(server_out));
544 ASSERT_EQ(OK, rv); 544 ASSERT_EQ(OK, rv);
545 545
546 unsigned char client_out[kKeyingMaterialSize]; 546 unsigned char client_out[kKeyingMaterialSize];
547 rv = client_socket_->ExportKeyingMaterial(kKeyingLabel, 547 rv = client_socket_->ExportKeyingMaterial(kKeyingLabel,
548 false, kKeyingContext, 548 false, kKeyingContext,
549 client_out, sizeof(client_out)); 549 client_out, sizeof(client_out));
550 ASSERT_EQ(OK, rv); 550 ASSERT_EQ(OK, rv);
551 EXPECT_EQ(0, memcmp(server_out, client_out, sizeof(server_out))); 551 EXPECT_EQ(0, memcmp(server_out, client_out, sizeof(server_out)));
552 552
553 const char* kKeyingLabelBad = "EXPERIMENTAL-server-socket-test-bad"; 553 const char kKeyingLabelBad[] = "EXPERIMENTAL-server-socket-test-bad";
554 unsigned char client_bad[kKeyingMaterialSize]; 554 unsigned char client_bad[kKeyingMaterialSize];
555 rv = client_socket_->ExportKeyingMaterial(kKeyingLabelBad, 555 rv = client_socket_->ExportKeyingMaterial(kKeyingLabelBad,
556 false, kKeyingContext, 556 false, kKeyingContext,
557 client_bad, sizeof(client_bad)); 557 client_bad, sizeof(client_bad));
558 ASSERT_EQ(rv, OK); 558 ASSERT_EQ(rv, OK);
559 EXPECT_NE(0, memcmp(server_out, client_bad, sizeof(server_out))); 559 EXPECT_NE(0, memcmp(server_out, client_bad, sizeof(server_out)));
560 } 560 }
561 561
562 } // namespace net 562 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_unittest.cc ('k') | net/socket/websocket_endpoint_lock_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698