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

Side by Side Diff: webrtc/api/peerconnectionendtoend_unittest.cc

Issue 2648003003: Revert of Removing #defines previously used for building without BoringSSL/OpenSSL. (Closed)
Patch Set: Created 3 years, 11 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 | « webrtc/api/peerconnection_unittest.cc ('k') | webrtc/api/peerconnectioninterface_unittest.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 * Copyright 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <memory> 11 #include <memory>
12 12
13 #include "webrtc/api/test/peerconnectiontestwrapper.h" 13 #include "webrtc/api/test/peerconnectiontestwrapper.h"
14 // Notice that mockpeerconnectionobservers.h must be included after the above! 14 // Notice that mockpeerconnectionobservers.h must be included after the above!
15 #include "webrtc/api/test/mockpeerconnectionobservers.h" 15 #include "webrtc/api/test/mockpeerconnectionobservers.h"
16 #ifdef WEBRTC_ANDROID 16 #ifdef WEBRTC_ANDROID
17 #include "webrtc/api/test/androidtestinitializer.h" 17 #include "webrtc/api/test/androidtestinitializer.h"
18 #endif 18 #endif
19 #include "webrtc/base/gunit.h" 19 #include "webrtc/base/gunit.h"
20 #include "webrtc/base/logging.h" 20 #include "webrtc/base/logging.h"
21 #include "webrtc/base/ssladapter.h" 21 #include "webrtc/base/ssladapter.h"
22 #include "webrtc/base/thread.h" 22 #include "webrtc/base/thread.h"
23 #include "webrtc/base/sslstreamadapter.h" 23 #include "webrtc/base/sslstreamadapter.h"
24 #include "webrtc/base/stringencode.h" 24 #include "webrtc/base/stringencode.h"
25 #include "webrtc/base/stringutils.h" 25 #include "webrtc/base/stringutils.h"
26 26
27 #define MAYBE_SKIP_TEST(feature) \
28 if (!(feature())) { \
29 LOG(LS_INFO) << "Feature disabled... skipping"; \
30 return; \
31 }
32
27 using webrtc::DataChannelInterface; 33 using webrtc::DataChannelInterface;
28 using webrtc::FakeConstraints; 34 using webrtc::FakeConstraints;
29 using webrtc::MediaConstraintsInterface; 35 using webrtc::MediaConstraintsInterface;
30 using webrtc::MediaStreamInterface; 36 using webrtc::MediaStreamInterface;
31 using webrtc::PeerConnectionInterface; 37 using webrtc::PeerConnectionInterface;
32 38
33 namespace { 39 namespace {
34 40
35 const int kMaxWait = 10000; 41 const int kMaxWait = 10000;
36 42
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 GetAndAddUserMedia(); 191 GetAndAddUserMedia();
186 Negotiate(); 192 Negotiate();
187 WaitForCallEstablished(); 193 WaitForCallEstablished();
188 } 194 }
189 #endif // !defined(ADDRESS_SANITIZER) 195 #endif // !defined(ADDRESS_SANITIZER)
190 196
191 #ifdef HAVE_SCTP 197 #ifdef HAVE_SCTP
192 // Verifies that a DataChannel created before the negotiation can transition to 198 // Verifies that a DataChannel created before the negotiation can transition to
193 // "OPEN" and transfer data. 199 // "OPEN" and transfer data.
194 TEST_F(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) { 200 TEST_F(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) {
201 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
202
195 CreatePcs(); 203 CreatePcs();
196 204
197 webrtc::DataChannelInit init; 205 webrtc::DataChannelInit init;
198 rtc::scoped_refptr<DataChannelInterface> caller_dc( 206 rtc::scoped_refptr<DataChannelInterface> caller_dc(
199 caller_->CreateDataChannel("data", init)); 207 caller_->CreateDataChannel("data", init));
200 rtc::scoped_refptr<DataChannelInterface> callee_dc( 208 rtc::scoped_refptr<DataChannelInterface> callee_dc(
201 callee_->CreateDataChannel("data", init)); 209 callee_->CreateDataChannel("data", init));
202 210
203 Negotiate(); 211 Negotiate();
204 WaitForConnection(); 212 WaitForConnection();
205 213
206 WaitForDataChannelsToOpen(caller_dc, callee_signaled_data_channels_, 0); 214 WaitForDataChannelsToOpen(caller_dc, callee_signaled_data_channels_, 0);
207 WaitForDataChannelsToOpen(callee_dc, caller_signaled_data_channels_, 0); 215 WaitForDataChannelsToOpen(callee_dc, caller_signaled_data_channels_, 0);
208 216
209 TestDataChannelSendAndReceive(caller_dc, callee_signaled_data_channels_[0]); 217 TestDataChannelSendAndReceive(caller_dc, callee_signaled_data_channels_[0]);
210 TestDataChannelSendAndReceive(callee_dc, caller_signaled_data_channels_[0]); 218 TestDataChannelSendAndReceive(callee_dc, caller_signaled_data_channels_[0]);
211 219
212 CloseDataChannels(caller_dc, callee_signaled_data_channels_, 0); 220 CloseDataChannels(caller_dc, callee_signaled_data_channels_, 0);
213 CloseDataChannels(callee_dc, caller_signaled_data_channels_, 0); 221 CloseDataChannels(callee_dc, caller_signaled_data_channels_, 0);
214 } 222 }
215 223
216 // Verifies that a DataChannel created after the negotiation can transition to 224 // Verifies that a DataChannel created after the negotiation can transition to
217 // "OPEN" and transfer data. 225 // "OPEN" and transfer data.
218 TEST_F(PeerConnectionEndToEndTest, CreateDataChannelAfterNegotiate) { 226 TEST_F(PeerConnectionEndToEndTest, CreateDataChannelAfterNegotiate) {
227 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
228
219 CreatePcs(); 229 CreatePcs();
220 230
221 webrtc::DataChannelInit init; 231 webrtc::DataChannelInit init;
222 232
223 // This DataChannel is for creating the data content in the negotiation. 233 // This DataChannel is for creating the data content in the negotiation.
224 rtc::scoped_refptr<DataChannelInterface> dummy( 234 rtc::scoped_refptr<DataChannelInterface> dummy(
225 caller_->CreateDataChannel("data", init)); 235 caller_->CreateDataChannel("data", init));
226 Negotiate(); 236 Negotiate();
227 WaitForConnection(); 237 WaitForConnection();
228 238
(...skipping 11 matching lines...) Expand all
240 250
241 TestDataChannelSendAndReceive(caller_dc, callee_signaled_data_channels_[1]); 251 TestDataChannelSendAndReceive(caller_dc, callee_signaled_data_channels_[1]);
242 TestDataChannelSendAndReceive(callee_dc, caller_signaled_data_channels_[0]); 252 TestDataChannelSendAndReceive(callee_dc, caller_signaled_data_channels_[0]);
243 253
244 CloseDataChannels(caller_dc, callee_signaled_data_channels_, 1); 254 CloseDataChannels(caller_dc, callee_signaled_data_channels_, 1);
245 CloseDataChannels(callee_dc, caller_signaled_data_channels_, 0); 255 CloseDataChannels(callee_dc, caller_signaled_data_channels_, 0);
246 } 256 }
247 257
248 // Verifies that DataChannel IDs are even/odd based on the DTLS roles. 258 // Verifies that DataChannel IDs are even/odd based on the DTLS roles.
249 TEST_F(PeerConnectionEndToEndTest, DataChannelIdAssignment) { 259 TEST_F(PeerConnectionEndToEndTest, DataChannelIdAssignment) {
260 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
261
250 CreatePcs(); 262 CreatePcs();
251 263
252 webrtc::DataChannelInit init; 264 webrtc::DataChannelInit init;
253 rtc::scoped_refptr<DataChannelInterface> caller_dc_1( 265 rtc::scoped_refptr<DataChannelInterface> caller_dc_1(
254 caller_->CreateDataChannel("data", init)); 266 caller_->CreateDataChannel("data", init));
255 rtc::scoped_refptr<DataChannelInterface> callee_dc_1( 267 rtc::scoped_refptr<DataChannelInterface> callee_dc_1(
256 callee_->CreateDataChannel("data", init)); 268 callee_->CreateDataChannel("data", init));
257 269
258 Negotiate(); 270 Negotiate();
259 WaitForConnection(); 271 WaitForConnection();
260 272
261 EXPECT_EQ(1U, caller_dc_1->id() % 2); 273 EXPECT_EQ(1U, caller_dc_1->id() % 2);
262 EXPECT_EQ(0U, callee_dc_1->id() % 2); 274 EXPECT_EQ(0U, callee_dc_1->id() % 2);
263 275
264 rtc::scoped_refptr<DataChannelInterface> caller_dc_2( 276 rtc::scoped_refptr<DataChannelInterface> caller_dc_2(
265 caller_->CreateDataChannel("data", init)); 277 caller_->CreateDataChannel("data", init));
266 rtc::scoped_refptr<DataChannelInterface> callee_dc_2( 278 rtc::scoped_refptr<DataChannelInterface> callee_dc_2(
267 callee_->CreateDataChannel("data", init)); 279 callee_->CreateDataChannel("data", init));
268 280
269 EXPECT_EQ(1U, caller_dc_2->id() % 2); 281 EXPECT_EQ(1U, caller_dc_2->id() % 2);
270 EXPECT_EQ(0U, callee_dc_2->id() % 2); 282 EXPECT_EQ(0U, callee_dc_2->id() % 2);
271 } 283 }
272 284
273 // Verifies that the message is received by the right remote DataChannel when 285 // Verifies that the message is received by the right remote DataChannel when
274 // there are multiple DataChannels. 286 // there are multiple DataChannels.
275 TEST_F(PeerConnectionEndToEndTest, 287 TEST_F(PeerConnectionEndToEndTest,
276 MessageTransferBetweenTwoPairsOfDataChannels) { 288 MessageTransferBetweenTwoPairsOfDataChannels) {
289 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
290
277 CreatePcs(); 291 CreatePcs();
278 292
279 webrtc::DataChannelInit init; 293 webrtc::DataChannelInit init;
280 294
281 rtc::scoped_refptr<DataChannelInterface> caller_dc_1( 295 rtc::scoped_refptr<DataChannelInterface> caller_dc_1(
282 caller_->CreateDataChannel("data", init)); 296 caller_->CreateDataChannel("data", init));
283 rtc::scoped_refptr<DataChannelInterface> caller_dc_2( 297 rtc::scoped_refptr<DataChannelInterface> caller_dc_2(
284 caller_->CreateDataChannel("data", init)); 298 caller_->CreateDataChannel("data", init));
285 299
286 Negotiate(); 300 Negotiate();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 // Verifies that a DataChannel added from an OPEN message functions after 402 // Verifies that a DataChannel added from an OPEN message functions after
389 // a channel has been previously closed (webrtc issue 3778). 403 // a channel has been previously closed (webrtc issue 3778).
390 // This previously failed because the new channel re-uses the ID of the closed 404 // This previously failed because the new channel re-uses the ID of the closed
391 // channel, and the closed channel was incorrectly still assigned to the id. 405 // channel, and the closed channel was incorrectly still assigned to the id.
392 // TODO(deadbeef): This is disabled because there's currently a race condition 406 // TODO(deadbeef): This is disabled because there's currently a race condition
393 // caused by the fact that a data channel signals that it's closed before it 407 // caused by the fact that a data channel signals that it's closed before it
394 // really is. Re-enable this test once that's fixed. 408 // really is. Re-enable this test once that's fixed.
395 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4453 409 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4453
396 TEST_F(PeerConnectionEndToEndTest, 410 TEST_F(PeerConnectionEndToEndTest,
397 DISABLED_DataChannelFromOpenWorksAfterClose) { 411 DISABLED_DataChannelFromOpenWorksAfterClose) {
412 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
413
398 CreatePcs(); 414 CreatePcs();
399 415
400 webrtc::DataChannelInit init; 416 webrtc::DataChannelInit init;
401 rtc::scoped_refptr<DataChannelInterface> caller_dc( 417 rtc::scoped_refptr<DataChannelInterface> caller_dc(
402 caller_->CreateDataChannel("data", init)); 418 caller_->CreateDataChannel("data", init));
403 419
404 Negotiate(); 420 Negotiate();
405 WaitForConnection(); 421 WaitForConnection();
406 422
407 WaitForDataChannelsToOpen(caller_dc, callee_signaled_data_channels_, 0); 423 WaitForDataChannelsToOpen(caller_dc, callee_signaled_data_channels_, 0);
408 CloseDataChannels(caller_dc, callee_signaled_data_channels_, 0); 424 CloseDataChannels(caller_dc, callee_signaled_data_channels_, 0);
409 425
410 // Create a new channel and ensure it works after closing the previous one. 426 // Create a new channel and ensure it works after closing the previous one.
411 caller_dc = caller_->CreateDataChannel("data2", init); 427 caller_dc = caller_->CreateDataChannel("data2", init);
412 428
413 WaitForDataChannelsToOpen(caller_dc, callee_signaled_data_channels_, 1); 429 WaitForDataChannelsToOpen(caller_dc, callee_signaled_data_channels_, 1);
414 TestDataChannelSendAndReceive(caller_dc, callee_signaled_data_channels_[1]); 430 TestDataChannelSendAndReceive(caller_dc, callee_signaled_data_channels_[1]);
415 431
416 CloseDataChannels(caller_dc, callee_signaled_data_channels_, 1); 432 CloseDataChannels(caller_dc, callee_signaled_data_channels_, 1);
417 } 433 }
418 434
419 // This tests that if a data channel is closed remotely while not referenced 435 // This tests that if a data channel is closed remotely while not referenced
420 // by the application (meaning only the PeerConnection contributes to its 436 // by the application (meaning only the PeerConnection contributes to its
421 // reference count), no memory access violation will occur. 437 // reference count), no memory access violation will occur.
422 // See: https://code.google.com/p/chromium/issues/detail?id=565048 438 // See: https://code.google.com/p/chromium/issues/detail?id=565048
423 TEST_F(PeerConnectionEndToEndTest, CloseDataChannelRemotelyWhileNotReferenced) { 439 TEST_F(PeerConnectionEndToEndTest, CloseDataChannelRemotelyWhileNotReferenced) {
440 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
441
424 CreatePcs(); 442 CreatePcs();
425 443
426 webrtc::DataChannelInit init; 444 webrtc::DataChannelInit init;
427 rtc::scoped_refptr<DataChannelInterface> caller_dc( 445 rtc::scoped_refptr<DataChannelInterface> caller_dc(
428 caller_->CreateDataChannel("data", init)); 446 caller_->CreateDataChannel("data", init));
429 447
430 Negotiate(); 448 Negotiate();
431 WaitForConnection(); 449 WaitForConnection();
432 450
433 WaitForDataChannelsToOpen(caller_dc, callee_signaled_data_channels_, 0); 451 WaitForDataChannelsToOpen(caller_dc, callee_signaled_data_channels_, 0);
434 // This removes the reference to the remote data channel that we hold. 452 // This removes the reference to the remote data channel that we hold.
435 callee_signaled_data_channels_.clear(); 453 callee_signaled_data_channels_.clear();
436 caller_dc->Close(); 454 caller_dc->Close();
437 EXPECT_EQ_WAIT(DataChannelInterface::kClosed, caller_dc->state(), kMaxWait); 455 EXPECT_EQ_WAIT(DataChannelInterface::kClosed, caller_dc->state(), kMaxWait);
438 456
439 // Wait for a bit longer so the remote data channel will receive the 457 // Wait for a bit longer so the remote data channel will receive the
440 // close message and be destroyed. 458 // close message and be destroyed.
441 rtc::Thread::Current()->ProcessMessages(100); 459 rtc::Thread::Current()->ProcessMessages(100);
442 } 460 }
443 #endif // HAVE_SCTP 461 #endif // HAVE_SCTP
OLDNEW
« no previous file with comments | « webrtc/api/peerconnection_unittest.cc ('k') | webrtc/api/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698