| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 267 |
| 268 std::string data_; | 268 std::string data_; |
| 269 }; | 269 }; |
| 270 | 270 |
| 271 class SSLAdapterTestBase : public testing::Test, | 271 class SSLAdapterTestBase : public testing::Test, |
| 272 public sigslot::has_slots<> { | 272 public sigslot::has_slots<> { |
| 273 public: | 273 public: |
| 274 explicit SSLAdapterTestBase(const rtc::SSLMode& ssl_mode, | 274 explicit SSLAdapterTestBase(const rtc::SSLMode& ssl_mode, |
| 275 const rtc::KeyParams& key_params) | 275 const rtc::KeyParams& key_params) |
| 276 : ssl_mode_(ssl_mode), | 276 : ssl_mode_(ssl_mode), |
| 277 ss_scope_(new rtc::VirtualSocketServer(nullptr)), | 277 vss_(new rtc::VirtualSocketServer(nullptr)), |
| 278 thread_(vss_.get()), |
| 278 server_(new SSLAdapterTestDummyServer(ssl_mode_, key_params)), | 279 server_(new SSLAdapterTestDummyServer(ssl_mode_, key_params)), |
| 279 client_(new SSLAdapterTestDummyClient(ssl_mode_)), | 280 client_(new SSLAdapterTestDummyClient(ssl_mode_)), |
| 280 handshake_wait_(kTimeout) {} | 281 handshake_wait_(kTimeout) {} |
| 281 | 282 |
| 282 void SetHandshakeWait(int wait) { | 283 void SetHandshakeWait(int wait) { |
| 283 handshake_wait_ = wait; | 284 handshake_wait_ = wait; |
| 284 } | 285 } |
| 285 | 286 |
| 286 void TestHandshake(bool expect_success) { | 287 void TestHandshake(bool expect_success) { |
| 287 int rv; | 288 int rv; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 | 332 |
| 332 // The client should have received the server's message. | 333 // The client should have received the server's message. |
| 333 EXPECT_EQ_WAIT(message, client_->GetReceivedData(), kTimeout); | 334 EXPECT_EQ_WAIT(message, client_->GetReceivedData(), kTimeout); |
| 334 | 335 |
| 335 LOG(LS_INFO) << "Transfer complete."; | 336 LOG(LS_INFO) << "Transfer complete."; |
| 336 } | 337 } |
| 337 | 338 |
| 338 private: | 339 private: |
| 339 const rtc::SSLMode ssl_mode_; | 340 const rtc::SSLMode ssl_mode_; |
| 340 | 341 |
| 341 const rtc::SocketServerScope ss_scope_; | 342 std::unique_ptr<rtc::VirtualSocketServer> vss_; |
| 342 | 343 rtc::AutoSocketServerThread thread_; |
| 343 std::unique_ptr<SSLAdapterTestDummyServer> server_; | 344 std::unique_ptr<SSLAdapterTestDummyServer> server_; |
| 344 std::unique_ptr<SSLAdapterTestDummyClient> client_; | 345 std::unique_ptr<SSLAdapterTestDummyClient> client_; |
| 345 | 346 |
| 346 int handshake_wait_; | 347 int handshake_wait_; |
| 347 }; | 348 }; |
| 348 | 349 |
| 349 class SSLAdapterTestTLS_RSA : public SSLAdapterTestBase { | 350 class SSLAdapterTestTLS_RSA : public SSLAdapterTestBase { |
| 350 public: | 351 public: |
| 351 SSLAdapterTestTLS_RSA() | 352 SSLAdapterTestTLS_RSA() |
| 352 : SSLAdapterTestBase(rtc::SSL_MODE_TLS, rtc::KeyParams::RSA()) {} | 353 : SSLAdapterTestBase(rtc::SSL_MODE_TLS, rtc::KeyParams::RSA()) {} |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 TEST_F(SSLAdapterTestDTLS_RSA, TestDTLSTransfer) { | 411 TEST_F(SSLAdapterTestDTLS_RSA, TestDTLSTransfer) { |
| 411 TestHandshake(true); | 412 TestHandshake(true); |
| 412 TestTransfer("Hello, world!"); | 413 TestTransfer("Hello, world!"); |
| 413 } | 414 } |
| 414 | 415 |
| 415 // Test transfer between client and server, using ECDSA | 416 // Test transfer between client and server, using ECDSA |
| 416 TEST_F(SSLAdapterTestDTLS_ECDSA, TestDTLSTransfer) { | 417 TEST_F(SSLAdapterTestDTLS_ECDSA, TestDTLSTransfer) { |
| 417 TestHandshake(true); | 418 TestHandshake(true); |
| 418 TestTransfer("Hello, world!"); | 419 TestTransfer("Hello, world!"); |
| 419 } | 420 } |
| OLD | NEW |