Chromium Code Reviews| Index: webrtc/p2p/base/dtlstransportchannel_unittest.cc |
| diff --git a/webrtc/p2p/base/dtlstransportchannel_unittest.cc b/webrtc/p2p/base/dtlstransportchannel_unittest.cc |
| index 8c1c21cd1e365928e12f6211334da7a00af521ad..14d0cd759dcde3fc9b269d95a90b0a39d83a6920 100644 |
| --- a/webrtc/p2p/base/dtlstransportchannel_unittest.cc |
| +++ b/webrtc/p2p/base/dtlstransportchannel_unittest.cc |
| @@ -62,8 +62,8 @@ class DtlsTestClient : public sigslot::has_slots<> { |
| void SetIceProtocol(cricket::TransportProtocol proto) { |
| protocol_ = proto; |
| } |
| - void CreateIdentity() { |
| - identity_.reset(rtc::SSLIdentity::Generate(name_)); |
| + void CreateIdentity(rtc::KeyType key_type) { |
| + identity_.reset(rtc::SSLIdentity::Generate(name_, key_type)); |
| } |
| rtc::SSLIdentity* identity() { return identity_.get(); } |
| void SetupSrtp() { |
| @@ -412,12 +412,12 @@ class DtlsTransportChannelTest : public testing::Test { |
| client2_.SetupMaxProtocolVersion(c2); |
| ssl_expected_version_ = std::min(c1, c2); |
| } |
| - void PrepareDtls(bool c1, bool c2) { |
| + void PrepareDtls(bool c1, bool c2, rtc::KeyType key_type) { |
| if (c1) { |
| - client1_.CreateIdentity(); |
| + client1_.CreateIdentity(key_type); |
| } |
| if (c2) { |
| - client2_.CreateIdentity(); |
| + client2_.CreateIdentity(key_type); |
| } |
| if (c1 && c2) |
| use_dtls_ = true; |
| @@ -614,9 +614,9 @@ TEST_F(DtlsTransportChannelTest, TestTransferSrtpTwoChannels) { |
| } |
| // Connect with DTLS, and transfer some data. |
| -TEST_F(DtlsTransportChannelTest, TestTransferDtls) { |
| +TEST_F(DtlsTransportChannelTest, TestTransferDtlsRSA) { |
|
juberti1
2015/06/26 19:16:02
These all seem like they should be KT_DEFAULT (and
torbjorng (webrtc)
2015/07/02 12:35:08
Done.
|
| MAYBE_SKIP_TEST(HaveDtls); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| ASSERT_TRUE(Connect()); |
| TestTransfer(0, 1000, 100, false); |
| } |
| @@ -625,7 +625,7 @@ TEST_F(DtlsTransportChannelTest, TestTransferDtls) { |
| TEST_F(DtlsTransportChannelTest, TestTransferDtlsTwoChannels) { |
| MAYBE_SKIP_TEST(HaveDtls); |
| SetChannelCount(2); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| ASSERT_TRUE(Connect()); |
| TestTransfer(0, 1000, 100, false); |
| TestTransfer(1, 1000, 100, false); |
| @@ -633,14 +633,14 @@ TEST_F(DtlsTransportChannelTest, TestTransferDtlsTwoChannels) { |
| // Connect with A doing DTLS and B not, and transfer some data. |
| TEST_F(DtlsTransportChannelTest, TestTransferDtlsRejected) { |
| - PrepareDtls(true, false); |
| + PrepareDtls(true, false, rtc::KT_RSA); |
| ASSERT_TRUE(Connect()); |
| TestTransfer(0, 1000, 100, false); |
| } |
| // Connect with B doing DTLS and A not, and transfer some data. |
| TEST_F(DtlsTransportChannelTest, TestTransferDtlsNotOffered) { |
| - PrepareDtls(false, true); |
| + PrepareDtls(false, true, rtc::KT_RSA); |
| ASSERT_TRUE(Connect()); |
| TestTransfer(0, 1000, 100, false); |
| } |
| @@ -649,7 +649,7 @@ TEST_F(DtlsTransportChannelTest, TestTransferDtlsNotOffered) { |
| TEST_F(DtlsTransportChannelTest, TestDtls12None) { |
| MAYBE_SKIP_TEST(HaveDtls); |
| SetChannelCount(2); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_10); |
| ASSERT_TRUE(Connect()); |
| } |
| @@ -658,7 +658,7 @@ TEST_F(DtlsTransportChannelTest, TestDtls12None) { |
| TEST_F(DtlsTransportChannelTest, TestDtls12Both) { |
| MAYBE_SKIP_TEST(HaveDtls); |
| SetChannelCount(2); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_12); |
| ASSERT_TRUE(Connect()); |
| } |
| @@ -667,7 +667,7 @@ TEST_F(DtlsTransportChannelTest, TestDtls12Both) { |
| TEST_F(DtlsTransportChannelTest, TestDtls12Client1) { |
| MAYBE_SKIP_TEST(HaveDtls); |
| SetChannelCount(2); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_10); |
| ASSERT_TRUE(Connect()); |
| } |
| @@ -676,7 +676,7 @@ TEST_F(DtlsTransportChannelTest, TestDtls12Client1) { |
| TEST_F(DtlsTransportChannelTest, TestDtls12Client2) { |
| MAYBE_SKIP_TEST(HaveDtls); |
| SetChannelCount(2); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_12); |
| ASSERT_TRUE(Connect()); |
| } |
| @@ -684,7 +684,7 @@ TEST_F(DtlsTransportChannelTest, TestDtls12Client2) { |
| // Connect with DTLS, negotiate DTLS-SRTP, and transfer SRTP using bypass. |
| TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtp) { |
| MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| PrepareDtlsSrtp(true, true); |
| ASSERT_TRUE(Connect()); |
| TestTransfer(0, 1000, 100, true); |
| @@ -694,7 +694,7 @@ TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtp) { |
| // returned. |
| TEST_F(DtlsTransportChannelTest, TestTransferDtlsInvalidSrtpPacket) { |
| MAYBE_SKIP_TEST(HaveDtls); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| PrepareDtlsSrtp(true, true); |
| ASSERT_TRUE(Connect()); |
| int result = client1_.SendInvalidSrtpPacket(0, 100); |
| @@ -704,7 +704,7 @@ TEST_F(DtlsTransportChannelTest, TestTransferDtlsInvalidSrtpPacket) { |
| // Connect with DTLS. A does DTLS-SRTP but B does not. |
| TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpRejected) { |
| MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| PrepareDtlsSrtp(true, false); |
| ASSERT_TRUE(Connect()); |
| } |
| @@ -712,7 +712,7 @@ TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpRejected) { |
| // Connect with DTLS. B does DTLS-SRTP but A does not. |
| TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpNotOffered) { |
| MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| PrepareDtlsSrtp(false, true); |
| ASSERT_TRUE(Connect()); |
| } |
| @@ -721,7 +721,7 @@ TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpNotOffered) { |
| TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpTwoChannels) { |
| MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| SetChannelCount(2); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| PrepareDtlsSrtp(true, true); |
| ASSERT_TRUE(Connect()); |
| TestTransfer(0, 1000, 100, true); |
| @@ -731,7 +731,7 @@ TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpTwoChannels) { |
| // Create a single channel with DTLS, and send normal data and SRTP data on it. |
| TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpDemux) { |
| MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| PrepareDtlsSrtp(true, true); |
| ASSERT_TRUE(Connect()); |
| TestTransfer(0, 1000, 100, false); |
| @@ -742,7 +742,7 @@ TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpDemux) { |
| TEST_F(DtlsTransportChannelTest, TestTransferDtlsAnswererIsPassive) { |
| MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| SetChannelCount(2); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| PrepareDtlsSrtp(true, true); |
| ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
| cricket::CONNECTIONROLE_PASSIVE)); |
| @@ -754,7 +754,7 @@ TEST_F(DtlsTransportChannelTest, TestTransferDtlsAnswererIsPassive) { |
| // In this case legacy is the answerer. |
| TEST_F(DtlsTransportChannelTest, TestDtlsSetupWithLegacyAsAnswerer) { |
| MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| NegotiateWithLegacy(); |
| rtc::SSLRole channel1_role; |
| rtc::SSLRole channel2_role; |
| @@ -769,7 +769,7 @@ TEST_F(DtlsTransportChannelTest, TestDtlsSetupWithLegacyAsAnswerer) { |
| TEST_F(DtlsTransportChannelTest, TestDtlsReOfferFromOfferer) { |
| MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| SetChannelCount(2); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| PrepareDtlsSrtp(true, true); |
| // Initial role for client1 is ACTPASS and client2 is ACTIVE. |
| ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
| @@ -786,7 +786,7 @@ TEST_F(DtlsTransportChannelTest, TestDtlsReOfferFromOfferer) { |
| TEST_F(DtlsTransportChannelTest, TestDtlsReOfferFromAnswerer) { |
| MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| SetChannelCount(2); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| PrepareDtlsSrtp(true, true); |
| // Initial role for client1 is ACTPASS and client2 is ACTIVE. |
| ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
| @@ -804,7 +804,7 @@ TEST_F(DtlsTransportChannelTest, TestDtlsReOfferFromAnswerer) { |
| TEST_F(DtlsTransportChannelTest, TestDtlsRoleReversal) { |
| MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| SetChannelCount(2); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| PrepareDtlsSrtp(true, true); |
| ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
| cricket::CONNECTIONROLE_PASSIVE)); |
| @@ -820,7 +820,7 @@ TEST_F(DtlsTransportChannelTest, TestDtlsRoleReversal) { |
| TEST_F(DtlsTransportChannelTest, TestDtlsReOfferWithDifferentSetupAttr) { |
| MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| SetChannelCount(2); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| PrepareDtlsSrtp(true, true); |
| ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
| cricket::CONNECTIONROLE_PASSIVE)); |
| @@ -836,7 +836,7 @@ TEST_F(DtlsTransportChannelTest, TestDtlsReOfferWithDifferentSetupAttr) { |
| TEST_F(DtlsTransportChannelTest, TestRenegotiateBeforeConnect) { |
| MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| SetChannelCount(2); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| PrepareDtlsSrtp(true, true); |
| Negotiate(); |
| @@ -853,7 +853,7 @@ TEST_F(DtlsTransportChannelTest, TestRenegotiateBeforeConnect) { |
| // Test Certificates state after negotiation but before connection. |
| TEST_F(DtlsTransportChannelTest, TestCertificatesBeforeConnect) { |
| MAYBE_SKIP_TEST(HaveDtls); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| Negotiate(); |
| rtc::scoped_ptr<rtc::SSLIdentity> identity1; |
| @@ -878,7 +878,7 @@ TEST_F(DtlsTransportChannelTest, TestCertificatesBeforeConnect) { |
| // Test Certificates state after connection. |
| TEST_F(DtlsTransportChannelTest, TestCertificatesAfterConnect) { |
| MAYBE_SKIP_TEST(HaveDtls); |
| - PrepareDtls(true, true); |
| + PrepareDtls(true, true, rtc::KT_RSA); |
| ASSERT_TRUE(Connect()); |
| rtc::scoped_ptr<rtc::SSLIdentity> identity1; |