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 thread_(new rtc::VirtualSocketServer(nullptr)), |
278 server_(new SSLAdapterTestDummyServer(ssl_mode_, key_params)), | 278 server_(new SSLAdapterTestDummyServer(ssl_mode_, key_params)), |
279 client_(new SSLAdapterTestDummyClient(ssl_mode_)), | 279 client_(new SSLAdapterTestDummyClient(ssl_mode_)), |
280 handshake_wait_(kTimeout) {} | 280 handshake_wait_(kTimeout) {} |
281 | 281 |
282 void SetHandshakeWait(int wait) { | 282 void SetHandshakeWait(int wait) { |
283 handshake_wait_ = wait; | 283 handshake_wait_ = wait; |
284 } | 284 } |
285 | 285 |
286 void TestHandshake(bool expect_success) { | 286 void TestHandshake(bool expect_success) { |
287 int rv; | 287 int rv; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 331 |
332 // The client should have received the server's message. | 332 // The client should have received the server's message. |
333 EXPECT_EQ_WAIT(message, client_->GetReceivedData(), kTimeout); | 333 EXPECT_EQ_WAIT(message, client_->GetReceivedData(), kTimeout); |
334 | 334 |
335 LOG(LS_INFO) << "Transfer complete."; | 335 LOG(LS_INFO) << "Transfer complete."; |
336 } | 336 } |
337 | 337 |
338 private: | 338 private: |
339 const rtc::SSLMode ssl_mode_; | 339 const rtc::SSLMode ssl_mode_; |
340 | 340 |
341 const rtc::SocketServerScope ss_scope_; | 341 rtc::AutoSocketServerThread thread_; |
342 | |
343 std::unique_ptr<SSLAdapterTestDummyServer> server_; | 342 std::unique_ptr<SSLAdapterTestDummyServer> server_; |
344 std::unique_ptr<SSLAdapterTestDummyClient> client_; | 343 std::unique_ptr<SSLAdapterTestDummyClient> client_; |
345 | 344 |
346 int handshake_wait_; | 345 int handshake_wait_; |
347 }; | 346 }; |
348 | 347 |
349 class SSLAdapterTestTLS_RSA : public SSLAdapterTestBase { | 348 class SSLAdapterTestTLS_RSA : public SSLAdapterTestBase { |
350 public: | 349 public: |
351 SSLAdapterTestTLS_RSA() | 350 SSLAdapterTestTLS_RSA() |
352 : SSLAdapterTestBase(rtc::SSL_MODE_TLS, rtc::KeyParams::RSA()) {} | 351 : 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) { | 409 TEST_F(SSLAdapterTestDTLS_RSA, TestDTLSTransfer) { |
411 TestHandshake(true); | 410 TestHandshake(true); |
412 TestTransfer("Hello, world!"); | 411 TestTransfer("Hello, world!"); |
413 } | 412 } |
414 | 413 |
415 // Test transfer between client and server, using ECDSA | 414 // Test transfer between client and server, using ECDSA |
416 TEST_F(SSLAdapterTestDTLS_ECDSA, TestDTLSTransfer) { | 415 TEST_F(SSLAdapterTestDTLS_ECDSA, TestDTLSTransfer) { |
417 TestHandshake(true); | 416 TestHandshake(true); |
418 TestTransfer("Hello, world!"); | 417 TestTransfer("Hello, world!"); |
419 } | 418 } |
OLD | NEW |