Index: webrtc/p2p/base/dtlstransportchannel_unittest.cc |
diff --git a/webrtc/p2p/base/dtlstransportchannel_unittest.cc b/webrtc/p2p/base/dtlstransportchannel_unittest.cc |
index 26f6578d7b0c6e5c77775f6f085d8c19d5187173..dfae0c88441066ef4f3298b65060a89598c864d2 100644 |
--- a/webrtc/p2p/base/dtlstransportchannel_unittest.cc |
+++ b/webrtc/p2p/base/dtlstransportchannel_unittest.cc |
@@ -51,6 +51,7 @@ class DtlsTestClient : public sigslot::has_slots<> { |
name_(name), |
signaling_thread_(signaling_thread), |
worker_thread_(worker_thread), |
+ protocol_(cricket::ICEPROTO_GOOGLE), |
packet_size_(0), |
use_dtls_srtp_(false), |
ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10), |
@@ -58,6 +59,9 @@ class DtlsTestClient : public sigslot::has_slots<> { |
received_dtls_client_hello_(false), |
received_dtls_server_hello_(false) { |
} |
+ void SetIceProtocol(cricket::TransportProtocol proto) { |
+ protocol_ = proto; |
+ } |
void CreateIdentity(rtc::KeyType key_type) { |
identity_.reset(rtc::SSLIdentity::Generate(name_, key_type)); |
} |
@@ -158,8 +162,10 @@ class DtlsTestClient : public sigslot::has_slots<> { |
} |
} |
+ std::string transport_type = (protocol_ == cricket::ICEPROTO_GOOGLE) ? |
+ cricket::NS_GINGLE_P2P : cricket::NS_JINGLE_ICE_UDP; |
cricket::TransportDescription local_desc( |
- std::vector<std::string>(), kIceUfrag1, kIcePwd1, |
+ transport_type, std::vector<std::string>(), kIceUfrag1, kIcePwd1, |
cricket::ICEMODE_FULL, local_role, |
// If remote if the offerer and has no DTLS support, answer will be |
// without any fingerprint. |
@@ -168,7 +174,7 @@ class DtlsTestClient : public sigslot::has_slots<> { |
cricket::Candidates()); |
cricket::TransportDescription remote_desc( |
- std::vector<std::string>(), kIceUfrag1, kIcePwd1, |
+ transport_type, std::vector<std::string>(), kIceUfrag1, kIcePwd1, |
cricket::ICEMODE_FULL, remote_role, remote_fingerprint.get(), |
cricket::Candidates()); |
@@ -370,6 +376,7 @@ class DtlsTestClient : public sigslot::has_slots<> { |
std::string name_; |
rtc::Thread* signaling_thread_; |
rtc::Thread* worker_thread_; |
+ cricket::TransportProtocol protocol_; |
rtc::scoped_ptr<rtc::SSLIdentity> identity_; |
rtc::scoped_ptr<cricket::FakeTransport> transport_; |
std::vector<cricket::DtlsTransportChannelWrapper*> channels_; |
@@ -542,6 +549,27 @@ class DtlsTransportChannelTest : public testing::Test { |
// Test that transport negotiation of ICE, no DTLS works properly. |
TEST_F(DtlsTransportChannelTest, TestChannelSetupIce) { |
+ client1_.SetIceProtocol(cricket::ICEPROTO_RFC5245); |
+ client2_.SetIceProtocol(cricket::ICEPROTO_RFC5245); |
+ Negotiate(); |
+ cricket::FakeTransportChannel* channel1 = client1_.GetFakeChannel(0); |
+ cricket::FakeTransportChannel* channel2 = client2_.GetFakeChannel(0); |
+ ASSERT_TRUE(channel1 != NULL); |
+ ASSERT_TRUE(channel2 != NULL); |
+ EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel1->GetIceRole()); |
+ EXPECT_EQ(1U, channel1->IceTiebreaker()); |
+ EXPECT_EQ(cricket::ICEPROTO_RFC5245, channel1->protocol()); |
+ EXPECT_EQ(kIceUfrag1, channel1->ice_ufrag()); |
+ EXPECT_EQ(kIcePwd1, channel1->ice_pwd()); |
+ EXPECT_EQ(cricket::ICEROLE_CONTROLLED, channel2->GetIceRole()); |
+ EXPECT_EQ(2U, channel2->IceTiebreaker()); |
+ EXPECT_EQ(cricket::ICEPROTO_RFC5245, channel2->protocol()); |
+} |
+ |
+// Test that transport negotiation of GICE, no DTLS works properly. |
+TEST_F(DtlsTransportChannelTest, TestChannelSetupGice) { |
+ client1_.SetIceProtocol(cricket::ICEPROTO_GOOGLE); |
+ client2_.SetIceProtocol(cricket::ICEPROTO_GOOGLE); |
Negotiate(); |
cricket::FakeTransportChannel* channel1 = client1_.GetFakeChannel(0); |
cricket::FakeTransportChannel* channel2 = client2_.GetFakeChannel(0); |
@@ -549,10 +577,12 @@ TEST_F(DtlsTransportChannelTest, TestChannelSetupIce) { |
ASSERT_TRUE(channel2 != NULL); |
EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel1->GetIceRole()); |
EXPECT_EQ(1U, channel1->IceTiebreaker()); |
+ EXPECT_EQ(cricket::ICEPROTO_GOOGLE, channel1->protocol()); |
EXPECT_EQ(kIceUfrag1, channel1->ice_ufrag()); |
EXPECT_EQ(kIcePwd1, channel1->ice_pwd()); |
EXPECT_EQ(cricket::ICEROLE_CONTROLLED, channel2->GetIceRole()); |
EXPECT_EQ(2U, channel2->IceTiebreaker()); |
+ EXPECT_EQ(cricket::ICEPROTO_GOOGLE, channel2->protocol()); |
} |
// Connect without DTLS, and transfer some data. |