Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: talk/app/webrtc/peerconnectionendtoend_unittest.cc

Issue 1336553003: Revert change which removes GICE (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/app/webrtc/peerconnection.cc ('k') | talk/app/webrtc/webrtcsdp.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 42
43 using webrtc::DataChannelInterface; 43 using webrtc::DataChannelInterface;
44 using webrtc::FakeConstraints; 44 using webrtc::FakeConstraints;
45 using webrtc::MediaConstraintsInterface; 45 using webrtc::MediaConstraintsInterface;
46 using webrtc::MediaStreamInterface; 46 using webrtc::MediaStreamInterface;
47 using webrtc::PeerConnectionInterface; 47 using webrtc::PeerConnectionInterface;
48 48
49 namespace { 49 namespace {
50 50
51 const char kExternalGiceUfrag[] = "1234567890123456";
52 const char kExternalGicePwd[] = "123456789012345678901234";
51 const size_t kMaxWait = 10000; 53 const size_t kMaxWait = 10000;
52 54
53 void RemoveLinesFromSdp(const std::string& line_start, 55 void RemoveLinesFromSdp(const std::string& line_start,
54 std::string* sdp) { 56 std::string* sdp) {
55 const char kSdpLineEnd[] = "\r\n"; 57 const char kSdpLineEnd[] = "\r\n";
56 size_t ssrc_pos = 0; 58 size_t ssrc_pos = 0;
57 while ((ssrc_pos = sdp->find(line_start, ssrc_pos)) != 59 while ((ssrc_pos = sdp->find(line_start, ssrc_pos)) !=
58 std::string::npos) { 60 std::string::npos) {
59 size_t end_ssrc = sdp->find(kSdpLineEnd, ssrc_pos); 61 size_t end_ssrc = sdp->find(kSdpLineEnd, ssrc_pos);
60 sdp->erase(ssrc_pos, end_ssrc - ssrc_pos + strlen(kSdpLineEnd)); 62 sdp->erase(ssrc_pos, end_ssrc - ssrc_pos + strlen(kSdpLineEnd));
(...skipping 28 matching lines...) Expand all
89 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " 91 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
90 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj\r\n"; 92 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj\r\n";
91 const char kDataSdes[] = 93 const char kDataSdes[] =
92 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " 94 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
93 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj\r\n"; 95 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj\r\n";
94 InjectAfter("a=mid:audio\r\n", kAudioSdes, sdp); 96 InjectAfter("a=mid:audio\r\n", kAudioSdes, sdp);
95 InjectAfter("a=mid:video\r\n", kVideoSdes, sdp); 97 InjectAfter("a=mid:video\r\n", kVideoSdes, sdp);
96 InjectAfter("a=mid:data\r\n", kDataSdes, sdp); 98 InjectAfter("a=mid:data\r\n", kDataSdes, sdp);
97 } 99 }
98 100
101 void UseGice(std::string* sdp) {
102 InjectAfter("t=0 0\r\n", "a=ice-options:google-ice\r\n", sdp);
103
104 std::string ufragline = "a=ice-ufrag:";
105 std::string pwdline = "a=ice-pwd:";
106 RemoveLinesFromSdp(ufragline, sdp);
107 RemoveLinesFromSdp(pwdline, sdp);
108 ufragline.append(kExternalGiceUfrag);
109 ufragline.append("\r\n");
110 pwdline.append(kExternalGicePwd);
111 pwdline.append("\r\n");
112 const std::string ufrag_pwd = ufragline + pwdline;
113
114 InjectAfter("a=mid:audio\r\n", ufrag_pwd, sdp);
115 InjectAfter("a=mid:video\r\n", ufrag_pwd, sdp);
116 InjectAfter("a=mid:data\r\n", ufrag_pwd, sdp);
117 }
118
99 void RemoveBundle(std::string* sdp) { 119 void RemoveBundle(std::string* sdp) {
100 RemoveLinesFromSdp("a=group:BUNDLE", sdp); 120 RemoveLinesFromSdp("a=group:BUNDLE", sdp);
101 } 121 }
102 122
103 } // namespace 123 } // namespace
104 124
105 class PeerConnectionEndToEndTest 125 class PeerConnectionEndToEndTest
106 : public sigslot::has_slots<>, 126 : public sigslot::has_slots<>,
107 public testing::Test { 127 public testing::Test {
108 public: 128 public:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 void WaitForCallEstablished() { 172 void WaitForCallEstablished() {
153 caller_->WaitForCallEstablished(); 173 caller_->WaitForCallEstablished();
154 callee_->WaitForCallEstablished(); 174 callee_->WaitForCallEstablished();
155 } 175 }
156 176
157 void WaitForConnection() { 177 void WaitForConnection() {
158 caller_->WaitForConnection(); 178 caller_->WaitForConnection();
159 callee_->WaitForConnection(); 179 callee_->WaitForConnection();
160 } 180 }
161 181
182 void SetupLegacySdpConverter() {
183 caller_->SignalOnSdpCreated.connect(
184 this, &PeerConnectionEndToEndTest::ConvertToLegacySdp);
185 callee_->SignalOnSdpCreated.connect(
186 this, &PeerConnectionEndToEndTest::ConvertToLegacySdp);
187 }
188
189 void ConvertToLegacySdp(std::string* sdp) {
190 UseExternalSdes(sdp);
191 UseGice(sdp);
192 RemoveBundle(sdp);
193 LOG(LS_INFO) << "ConvertToLegacySdp: " << *sdp;
194 }
195
196 void SetupGiceConverter() {
197 caller_->SignalOnIceCandidateCreated.connect(
198 this, &PeerConnectionEndToEndTest::AddGiceCredsToCandidate);
199 callee_->SignalOnIceCandidateCreated.connect(
200 this, &PeerConnectionEndToEndTest::AddGiceCredsToCandidate);
201 }
202
203 void AddGiceCredsToCandidate(std::string* sdp) {
204 std::string gice_creds = " username ";
205 gice_creds.append(kExternalGiceUfrag);
206 gice_creds.append(" password ");
207 gice_creds.append(kExternalGicePwd);
208 gice_creds.append("\r\n");
209 Replace("\r\n", gice_creds, sdp);
210 LOG(LS_INFO) << "AddGiceCredsToCandidate: " << *sdp;
211 }
212
162 void OnCallerAddedDataChanel(DataChannelInterface* dc) { 213 void OnCallerAddedDataChanel(DataChannelInterface* dc) {
163 caller_signaled_data_channels_.push_back(dc); 214 caller_signaled_data_channels_.push_back(dc);
164 } 215 }
165 216
166 void OnCalleeAddedDataChannel(DataChannelInterface* dc) { 217 void OnCalleeAddedDataChannel(DataChannelInterface* dc) {
167 callee_signaled_data_channels_.push_back(dc); 218 callee_signaled_data_channels_.push_back(dc);
168 } 219 }
169 220
170 // Tests that |dc1| and |dc2| can send to and receive from each other. 221 // Tests that |dc1| and |dc2| can send to and receive from each other.
171 void TestDataChannelSendAndReceive( 222 void TestDataChannelSendAndReceive(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 Negotiate(); 274 Negotiate();
224 WaitForCallEstablished(); 275 WaitForCallEstablished();
225 } 276 }
226 277
227 // Disabled per b/14899892 278 // Disabled per b/14899892
228 TEST_F(PeerConnectionEndToEndTest, DISABLED_CallWithLegacySdp) { 279 TEST_F(PeerConnectionEndToEndTest, DISABLED_CallWithLegacySdp) {
229 FakeConstraints pc_constraints; 280 FakeConstraints pc_constraints;
230 pc_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, 281 pc_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
231 false); 282 false);
232 CreatePcs(&pc_constraints); 283 CreatePcs(&pc_constraints);
284 SetupLegacySdpConverter();
285 SetupGiceConverter();
233 GetAndAddUserMedia(); 286 GetAndAddUserMedia();
234 Negotiate(); 287 Negotiate();
235 WaitForCallEstablished(); 288 WaitForCallEstablished();
236 } 289 }
237 290
238 // Verifies that a DataChannel created before the negotiation can transition to 291 // Verifies that a DataChannel created before the negotiation can transition to
239 // "OPEN" and transfer data. 292 // "OPEN" and transfer data.
240 TEST_F(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) { 293 TEST_F(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) {
241 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); 294 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
242 295
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 410
358 caller_dc_1->Send(webrtc::DataBuffer(message_1)); 411 caller_dc_1->Send(webrtc::DataBuffer(message_1));
359 EXPECT_EQ_WAIT(message_1, dc_1_observer->last_message(), kMaxWait); 412 EXPECT_EQ_WAIT(message_1, dc_1_observer->last_message(), kMaxWait);
360 413
361 caller_dc_2->Send(webrtc::DataBuffer(message_2)); 414 caller_dc_2->Send(webrtc::DataBuffer(message_2));
362 EXPECT_EQ_WAIT(message_2, dc_2_observer->last_message(), kMaxWait); 415 EXPECT_EQ_WAIT(message_2, dc_2_observer->last_message(), kMaxWait);
363 416
364 EXPECT_EQ(1U, dc_1_observer->received_message_count()); 417 EXPECT_EQ(1U, dc_1_observer->received_message_count());
365 EXPECT_EQ(1U, dc_2_observer->received_message_count()); 418 EXPECT_EQ(1U, dc_2_observer->received_message_count());
366 } 419 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/peerconnection.cc ('k') | talk/app/webrtc/webrtcsdp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698