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

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

Issue 1353713002: Remove GICE (again). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Undo .gclient 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";
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 Negotiate(); 223 Negotiate();
275 WaitForCallEstablished(); 224 WaitForCallEstablished();
276 } 225 }
277 226
278 // Disabled per b/14899892 227 // Disabled per b/14899892
279 TEST_F(PeerConnectionEndToEndTest, DISABLED_CallWithLegacySdp) { 228 TEST_F(PeerConnectionEndToEndTest, DISABLED_CallWithLegacySdp) {
280 FakeConstraints pc_constraints; 229 FakeConstraints pc_constraints;
281 pc_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, 230 pc_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
282 false); 231 false);
283 CreatePcs(&pc_constraints); 232 CreatePcs(&pc_constraints);
284 SetupLegacySdpConverter();
285 SetupGiceConverter();
286 GetAndAddUserMedia(); 233 GetAndAddUserMedia();
287 Negotiate(); 234 Negotiate();
288 WaitForCallEstablished(); 235 WaitForCallEstablished();
289 } 236 }
290 237
291 // Verifies that a DataChannel created before the negotiation can transition to 238 // Verifies that a DataChannel created before the negotiation can transition to
292 // "OPEN" and transfer data. 239 // "OPEN" and transfer data.
293 TEST_F(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) { 240 TEST_F(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) {
294 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); 241 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
295 242
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 357
411 caller_dc_1->Send(webrtc::DataBuffer(message_1)); 358 caller_dc_1->Send(webrtc::DataBuffer(message_1));
412 EXPECT_EQ_WAIT(message_1, dc_1_observer->last_message(), kMaxWait); 359 EXPECT_EQ_WAIT(message_1, dc_1_observer->last_message(), kMaxWait);
413 360
414 caller_dc_2->Send(webrtc::DataBuffer(message_2)); 361 caller_dc_2->Send(webrtc::DataBuffer(message_2));
415 EXPECT_EQ_WAIT(message_2, dc_2_observer->last_message(), kMaxWait); 362 EXPECT_EQ_WAIT(message_2, dc_2_observer->last_message(), kMaxWait);
416 363
417 EXPECT_EQ(1U, dc_1_observer->received_message_count()); 364 EXPECT_EQ(1U, dc_1_observer->received_message_count());
418 EXPECT_EQ(1U, dc_2_observer->received_message_count()); 365 EXPECT_EQ(1U, dc_2_observer->received_message_count());
419 } 366 }
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