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

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

Issue 1263663002: Remove GICE. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: merge Created 5 years, 4 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";
53 const size_t kMaxWait = 10000; 51 const size_t kMaxWait = 10000;
54 52
55 void RemoveLinesFromSdp(const std::string& line_start, 53 void RemoveLinesFromSdp(const std::string& line_start,
56 std::string* sdp) { 54 std::string* sdp) {
57 const char kSdpLineEnd[] = "\r\n"; 55 const char kSdpLineEnd[] = "\r\n";
58 size_t ssrc_pos = 0; 56 size_t ssrc_pos = 0;
59 while ((ssrc_pos = sdp->find(line_start, ssrc_pos)) != 57 while ((ssrc_pos = sdp->find(line_start, ssrc_pos)) !=
60 std::string::npos) { 58 std::string::npos) {
61 size_t end_ssrc = sdp->find(kSdpLineEnd, ssrc_pos); 59 size_t end_ssrc = sdp->find(kSdpLineEnd, ssrc_pos);
62 sdp->erase(ssrc_pos, end_ssrc - ssrc_pos + strlen(kSdpLineEnd)); 60 sdp->erase(ssrc_pos, end_ssrc - ssrc_pos + strlen(kSdpLineEnd));
(...skipping 28 matching lines...) Expand all
91 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " 89 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
92 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj\r\n"; 90 "inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj\r\n";
93 const char kDataSdes[] = 91 const char kDataSdes[] =
94 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 " 92 "a=crypto:1 AES_CM_128_HMAC_SHA1_80 "
95 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj\r\n"; 93 "inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj\r\n";
96 InjectAfter("a=mid:audio\r\n", kAudioSdes, sdp); 94 InjectAfter("a=mid:audio\r\n", kAudioSdes, sdp);
97 InjectAfter("a=mid:video\r\n", kVideoSdes, sdp); 95 InjectAfter("a=mid:video\r\n", kVideoSdes, sdp);
98 InjectAfter("a=mid:data\r\n", kDataSdes, sdp); 96 InjectAfter("a=mid:data\r\n", kDataSdes, sdp);
99 } 97 }
100 98
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
119 void RemoveBundle(std::string* sdp) { 99 void RemoveBundle(std::string* sdp) {
120 RemoveLinesFromSdp("a=group:BUNDLE", sdp); 100 RemoveLinesFromSdp("a=group:BUNDLE", sdp);
121 } 101 }
122 102
123 } // namespace 103 } // namespace
124 104
125 class PeerConnectionEndToEndTest 105 class PeerConnectionEndToEndTest
126 : public sigslot::has_slots<>, 106 : public sigslot::has_slots<>,
127 public testing::Test { 107 public testing::Test {
128 public: 108 public:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 void WaitForCallEstablished() { 152 void WaitForCallEstablished() {
173 caller_->WaitForCallEstablished(); 153 caller_->WaitForCallEstablished();
174 callee_->WaitForCallEstablished(); 154 callee_->WaitForCallEstablished();
175 } 155 }
176 156
177 void WaitForConnection() { 157 void WaitForConnection() {
178 caller_->WaitForConnection(); 158 caller_->WaitForConnection();
179 callee_->WaitForConnection(); 159 callee_->WaitForConnection();
180 } 160 }
181 161
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
213 void OnCallerAddedDataChanel(DataChannelInterface* dc) { 162 void OnCallerAddedDataChanel(DataChannelInterface* dc) {
214 caller_signaled_data_channels_.push_back(dc); 163 caller_signaled_data_channels_.push_back(dc);
215 } 164 }
216 165
217 void OnCalleeAddedDataChannel(DataChannelInterface* dc) { 166 void OnCalleeAddedDataChannel(DataChannelInterface* dc) {
218 callee_signaled_data_channels_.push_back(dc); 167 callee_signaled_data_channels_.push_back(dc);
219 } 168 }
220 169
221 // Tests that |dc1| and |dc2| can send to and receive from each other. 170 // Tests that |dc1| and |dc2| can send to and receive from each other.
222 void TestDataChannelSendAndReceive( 171 void TestDataChannelSendAndReceive(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 Negotiate(); 233 Negotiate();
285 WaitForCallEstablished(); 234 WaitForCallEstablished();
286 } 235 }
287 236
288 // Disabled per b/14899892 237 // Disabled per b/14899892
289 TEST_F(PeerConnectionEndToEndTest, DISABLED_CallWithLegacySdp) { 238 TEST_F(PeerConnectionEndToEndTest, DISABLED_CallWithLegacySdp) {
290 FakeConstraints pc_constraints; 239 FakeConstraints pc_constraints;
291 pc_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, 240 pc_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
292 false); 241 false);
293 CreatePcs(&pc_constraints); 242 CreatePcs(&pc_constraints);
294 SetupLegacySdpConverter();
295 SetupGiceConverter();
296 GetAndAddUserMedia(); 243 GetAndAddUserMedia();
297 Negotiate(); 244 Negotiate();
298 WaitForCallEstablished(); 245 WaitForCallEstablished();
299 } 246 }
300 247
301 // Verifies that a DataChannel created before the negotiation can transition to 248 // Verifies that a DataChannel created before the negotiation can transition to
302 // "OPEN" and transfer data. 249 // "OPEN" and transfer data.
303 TEST_F(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) { 250 TEST_F(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) {
304 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); 251 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
305 252
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 caller_dc_1->Send(webrtc::DataBuffer(message_1)); 368 caller_dc_1->Send(webrtc::DataBuffer(message_1));
422 EXPECT_EQ_WAIT(message_1, dc_1_observer->last_message(), kMaxWait); 369 EXPECT_EQ_WAIT(message_1, dc_1_observer->last_message(), kMaxWait);
423 370
424 caller_dc_2->Send(webrtc::DataBuffer(message_2)); 371 caller_dc_2->Send(webrtc::DataBuffer(message_2));
425 EXPECT_EQ_WAIT(message_2, dc_2_observer->last_message(), kMaxWait); 372 EXPECT_EQ_WAIT(message_2, dc_2_observer->last_message(), kMaxWait);
426 373
427 EXPECT_EQ(1U, dc_1_observer->received_message_count()); 374 EXPECT_EQ(1U, dc_1_observer->received_message_count());
428 EXPECT_EQ(1U, dc_2_observer->received_message_count()); 375 EXPECT_EQ(1U, dc_2_observer->received_message_count());
429 } 376 }
430 #endif // if !defined(THREAD_SANITIZER) 377 #endif // if !defined(THREAD_SANITIZER)
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