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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 ASSERT_EQ(net::OK, connect_callback.WaitForResult()); | 448 ASSERT_EQ(net::OK, connect_callback.WaitForResult()); |
449 } | 449 } |
450 if (server_ret == net::ERR_IO_PENDING) { | 450 if (server_ret == net::ERR_IO_PENDING) { |
451 ASSERT_EQ(net::OK, handshake_callback.WaitForResult()); | 451 ASSERT_EQ(net::OK, handshake_callback.WaitForResult()); |
452 } | 452 } |
453 | 453 |
454 const int kKeyingMaterialSize = 32; | 454 const int kKeyingMaterialSize = 32; |
455 const char* kKeyingLabel = "EXPERIMENTAL-server-socket-test"; | 455 const char* kKeyingLabel = "EXPERIMENTAL-server-socket-test"; |
456 const char* kKeyingContext = ""; | 456 const char* kKeyingContext = ""; |
457 unsigned char server_out[kKeyingMaterialSize]; | 457 unsigned char server_out[kKeyingMaterialSize]; |
458 int rv = server_socket_->ExportKeyingMaterial(kKeyingLabel, kKeyingContext, | 458 int rv = server_socket_->ExportKeyingMaterial(kKeyingLabel, |
| 459 false, kKeyingContext, |
459 server_out, sizeof(server_out)); | 460 server_out, sizeof(server_out)); |
460 ASSERT_EQ(rv, net::OK); | 461 ASSERT_EQ(rv, net::OK); |
461 | 462 |
462 unsigned char client_out[kKeyingMaterialSize]; | 463 unsigned char client_out[kKeyingMaterialSize]; |
463 rv = client_socket_->ExportKeyingMaterial(kKeyingLabel, kKeyingContext, | 464 rv = client_socket_->ExportKeyingMaterial(kKeyingLabel, |
| 465 false, kKeyingContext, |
464 client_out, sizeof(client_out)); | 466 client_out, sizeof(client_out)); |
465 ASSERT_EQ(rv, net::OK); | 467 ASSERT_EQ(rv, net::OK); |
466 EXPECT_TRUE(memcmp(server_out, client_out, sizeof(server_out)) == 0); | 468 EXPECT_TRUE(memcmp(server_out, client_out, sizeof(server_out)) == 0); |
467 | 469 |
468 const char* kKeyingLabelBad = "EXPERIMENTAL-server-socket-test-bad"; | 470 const char* kKeyingLabelBad = "EXPERIMENTAL-server-socket-test-bad"; |
469 unsigned char client_bad[kKeyingMaterialSize]; | 471 unsigned char client_bad[kKeyingMaterialSize]; |
470 rv = client_socket_->ExportKeyingMaterial(kKeyingLabelBad, kKeyingContext, | 472 rv = client_socket_->ExportKeyingMaterial(kKeyingLabelBad, |
| 473 false, kKeyingContext, |
471 client_bad, sizeof(client_bad)); | 474 client_bad, sizeof(client_bad)); |
472 ASSERT_EQ(rv, net::OK); | 475 ASSERT_EQ(rv, net::OK); |
473 EXPECT_TRUE(memcmp(server_out, client_bad, sizeof(server_out)) != 0); | 476 EXPECT_TRUE(memcmp(server_out, client_bad, sizeof(server_out)) != 0); |
474 } | 477 } |
475 #endif | 478 #endif |
476 | 479 |
477 } // namespace net | 480 } // namespace net |
OLD | NEW |