Chromium Code Reviews| Index: webrtc/base/ssladapter_unittest.cc | 
| diff --git a/webrtc/base/ssladapter_unittest.cc b/webrtc/base/ssladapter_unittest.cc | 
| index 9a0548602e20eae23eb1550eaaf0c7b967052298..ccf3908a364ed43c3845f3cef4e8969868d0e0e5 100644 | 
| --- a/webrtc/base/ssladapter_unittest.cc | 
| +++ b/webrtc/base/ssladapter_unittest.cc | 
| @@ -15,6 +15,7 @@ | 
| #include "webrtc/base/socketstream.h" | 
| #include "webrtc/base/ssladapter.h" | 
| #include "webrtc/base/sslstreamadapter.h" | 
| +#include "webrtc/base/sslidentity.h" | 
| #include "webrtc/base/stream.h" | 
| #include "webrtc/base/virtualsocketserver.h" | 
| @@ -129,10 +130,11 @@ class SSLAdapterTestDummyClient : public sigslot::has_slots<> { | 
| class SSLAdapterTestDummyServer : public sigslot::has_slots<> { | 
| public: | 
| - explicit SSLAdapterTestDummyServer(const rtc::SSLMode& ssl_mode) | 
| + explicit SSLAdapterTestDummyServer(const rtc::SSLMode& ssl_mode, | 
| + const rtc::KeyType key_type) | 
| : ssl_mode_(ssl_mode) { | 
| // Generate a key pair and a certificate for this host. | 
| - ssl_identity_.reset(rtc::SSLIdentity::Generate(GetHostname())); | 
| + ssl_identity_.reset(rtc::SSLIdentity::Generate(GetHostname(), key_type)); | 
| server_socket_.reset(CreateSocket(ssl_mode_)); | 
| @@ -268,13 +270,13 @@ class SSLAdapterTestDummyServer : public sigslot::has_slots<> { | 
| class SSLAdapterTestBase : public testing::Test, | 
| public sigslot::has_slots<> { | 
| public: | 
| - explicit SSLAdapterTestBase(const rtc::SSLMode& ssl_mode) | 
| + explicit SSLAdapterTestBase(const rtc::SSLMode& ssl_mode, | 
| + const rtc::KeyType key_type) | 
| : ssl_mode_(ssl_mode), | 
| ss_scope_(new rtc::VirtualSocketServer(NULL)), | 
| - server_(new SSLAdapterTestDummyServer(ssl_mode_)), | 
| + server_(new SSLAdapterTestDummyServer(ssl_mode_, key_type)), | 
| client_(new SSLAdapterTestDummyClient(ssl_mode_)), | 
| - handshake_wait_(kTimeout) { | 
| - } | 
| + handshake_wait_(kTimeout) {} | 
| void SetHandshakeWait(int wait) { | 
| handshake_wait_ = wait; | 
| @@ -343,27 +345,52 @@ class SSLAdapterTestBase : public testing::Test, | 
| int handshake_wait_; | 
| }; | 
| -class SSLAdapterTestTLS : public SSLAdapterTestBase { | 
| +class SSLAdapterTestTLS_RSA : public SSLAdapterTestBase { | 
| public: | 
| - SSLAdapterTestTLS() : SSLAdapterTestBase(rtc::SSL_MODE_TLS) {} | 
| + SSLAdapterTestTLS_RSA() | 
| + : SSLAdapterTestBase(rtc::SSL_MODE_TLS, rtc::KT_RSA) {} | 
| }; | 
| -class SSLAdapterTestDTLS : public SSLAdapterTestBase { | 
| +class SSLAdapterTestTLS_ECDSA : public SSLAdapterTestBase { | 
| public: | 
| - SSLAdapterTestDTLS() : SSLAdapterTestBase(rtc::SSL_MODE_DTLS) {} | 
| + SSLAdapterTestTLS_ECDSA() | 
| + : SSLAdapterTestBase(rtc::SSL_MODE_TLS, rtc::KT_ECDSA) {} | 
| +}; | 
| + | 
| +class SSLAdapterTestDTLS_RSA : public SSLAdapterTestBase { | 
| + public: | 
| + SSLAdapterTestDTLS_RSA() | 
| + : SSLAdapterTestBase(rtc::SSL_MODE_DTLS, rtc::KT_RSA) {} | 
| +}; | 
| + | 
| +class SSLAdapterTestDTLS_ECDSA : public SSLAdapterTestBase { | 
| + public: | 
| + SSLAdapterTestDTLS_ECDSA() | 
| + : SSLAdapterTestBase(rtc::SSL_MODE_DTLS, rtc::KT_ECDSA) {} | 
| }; | 
| #if SSL_USE_OPENSSL | 
| // Basic tests: TLS | 
| -// Test that handshake works | 
| -TEST_F(SSLAdapterTestTLS, TestTLSConnect) { | 
| +// Test that handshake works, using RSA | 
| +TEST_F(SSLAdapterTestTLS_RSA, TestTLSConnect) { | 
| TestHandshake(true); | 
| } | 
| -// Test transfer between client and server | 
| -TEST_F(SSLAdapterTestTLS, TestTLSTransfer) { | 
| +// Test that handshake works, using ECDSA | 
| +TEST_F(SSLAdapterTestTLS_ECDSA, TestTLSConnect) { | 
| + TestHandshake(true); | 
| +} | 
| + | 
| +// Test transfer between client and server, using RSA | 
| +TEST_F(SSLAdapterTestTLS_RSA, TestTLSTransfer) { | 
| + TestHandshake(true); | 
| + TestTransfer("Hello, world!"); | 
| +} | 
| + | 
| +// Test transfer between client and server, using ECDSA | 
| +TEST_F(SSLAdapterTestTLS_ECDSA, TestTLSTransfer) { | 
| TestHandshake(true); | 
| TestTransfer("Hello, world!"); | 
| } | 
| @@ -371,15 +398,14 @@ TEST_F(SSLAdapterTestTLS, TestTLSTransfer) { | 
| // Basic tests: DTLS | 
| // Test that handshake works | 
| -TEST_F(SSLAdapterTestDTLS, TestDTLSConnect) { | 
| +TEST_F(SSLAdapterTestDTLS_RSA, TestDTLSConnect) { | 
| 
 
juberti1
2015/06/26 19:16:01
I think we need to add DTLS with ECDSA tests here.
 
torbjorng (webrtc)
2015/07/02 12:35:07
Oops.  (I suppose this could use TEST_P here for a
 
 | 
| TestHandshake(true); | 
| } | 
| // Test transfer between client and server | 
| -TEST_F(SSLAdapterTestDTLS, TestDTLSTransfer) { | 
| +TEST_F(SSLAdapterTestDTLS_RSA, TestDTLSTransfer) { | 
| TestHandshake(true); | 
| TestTransfer("Hello, world!"); | 
| } | 
| #endif // SSL_USE_OPENSSL | 
| - |