OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 15 matching lines...) Expand all Loading... |
26 */ | 26 */ |
27 | 27 |
28 #include <stdio.h> | 28 #include <stdio.h> |
29 | 29 |
30 #include <algorithm> | 30 #include <algorithm> |
31 #include <list> | 31 #include <list> |
32 #include <map> | 32 #include <map> |
33 #include <vector> | 33 #include <vector> |
34 | 34 |
35 #include "talk/app/webrtc/dtmfsender.h" | 35 #include "talk/app/webrtc/dtmfsender.h" |
| 36 #include "talk/app/webrtc/fakemetricsobserver.h" |
36 #include "talk/app/webrtc/fakeportallocatorfactory.h" | 37 #include "talk/app/webrtc/fakeportallocatorfactory.h" |
37 #include "talk/app/webrtc/localaudiosource.h" | 38 #include "talk/app/webrtc/localaudiosource.h" |
38 #include "talk/app/webrtc/mediastreaminterface.h" | 39 #include "talk/app/webrtc/mediastreaminterface.h" |
39 #include "talk/app/webrtc/peerconnectionfactory.h" | 40 #include "talk/app/webrtc/peerconnectionfactory.h" |
40 #include "talk/app/webrtc/peerconnectioninterface.h" | 41 #include "talk/app/webrtc/peerconnectioninterface.h" |
41 #include "talk/app/webrtc/test/fakeaudiocapturemodule.h" | 42 #include "talk/app/webrtc/test/fakeaudiocapturemodule.h" |
42 #include "talk/app/webrtc/test/fakeconstraints.h" | 43 #include "talk/app/webrtc/test/fakeconstraints.h" |
43 #include "talk/app/webrtc/test/fakedtlsidentityservice.h" | 44 #include "talk/app/webrtc/test/fakedtlsidentityservice.h" |
44 #include "talk/app/webrtc/test/fakeperiodicvideocapturer.h" | 45 #include "talk/app/webrtc/test/fakeperiodicvideocapturer.h" |
45 #include "talk/app/webrtc/test/fakevideotrackrenderer.h" | 46 #include "talk/app/webrtc/test/fakevideotrackrenderer.h" |
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 kMaxWaitForStatsMs); | 1323 kMaxWaitForStatsMs); |
1323 } | 1324 } |
1324 | 1325 |
1325 // Test that DTLS 1.0 is used if both sides only support DTLS 1.0. | 1326 // Test that DTLS 1.0 is used if both sides only support DTLS 1.0. |
1326 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12None) { | 1327 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12None) { |
1327 PeerConnectionFactory::Options init_options; | 1328 PeerConnectionFactory::Options init_options; |
1328 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1329 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
1329 PeerConnectionFactory::Options recv_options; | 1330 PeerConnectionFactory::Options recv_options; |
1330 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1331 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
1331 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); | 1332 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); |
| 1333 webrtc::FakeMetricsObserver init_observer; |
| 1334 initializing_client()->pc()->RegisterUMAObserver(&init_observer); |
1332 LocalP2PTest(); | 1335 LocalP2PTest(); |
1333 | 1336 |
1334 EXPECT_EQ_WAIT( | 1337 EXPECT_EQ_WAIT( |
1335 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), | 1338 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), |
1336 initializing_client()->GetDtlsCipherStats(), | 1339 initializing_client()->GetDtlsCipherStats(), |
1337 kMaxWaitForStatsMs); | 1340 kMaxWaitForStatsMs); |
| 1341 EXPECT_EQ( |
| 1342 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), |
| 1343 init_observer.ssl_cipher_["audio"]); |
1338 | 1344 |
1339 EXPECT_EQ_WAIT( | 1345 EXPECT_EQ_WAIT( |
1340 kDefaultSrtpCipher, | 1346 kDefaultSrtpCipher, |
1341 initializing_client()->GetSrtpCipherStats(), | 1347 initializing_client()->GetSrtpCipherStats(), |
1342 kMaxWaitForStatsMs); | 1348 kMaxWaitForStatsMs); |
| 1349 EXPECT_EQ( |
| 1350 kDefaultSrtpCipher, |
| 1351 init_observer.srtp_cipher_["audio"]); |
1343 } | 1352 } |
1344 | 1353 |
1345 // Test that DTLS 1.2 is used if both ends support it. | 1354 // Test that DTLS 1.2 is used if both ends support it. |
1346 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Both) { | 1355 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Both) { |
1347 PeerConnectionFactory::Options init_options; | 1356 PeerConnectionFactory::Options init_options; |
1348 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1357 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
1349 PeerConnectionFactory::Options recv_options; | 1358 PeerConnectionFactory::Options recv_options; |
1350 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1359 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
1351 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); | 1360 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); |
| 1361 webrtc::FakeMetricsObserver init_observer; |
| 1362 initializing_client()->pc()->RegisterUMAObserver(&init_observer); |
1352 LocalP2PTest(); | 1363 LocalP2PTest(); |
1353 | 1364 |
1354 EXPECT_EQ_WAIT( | 1365 EXPECT_EQ_WAIT( |
1355 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_12), | 1366 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_12), |
1356 initializing_client()->GetDtlsCipherStats(), | 1367 initializing_client()->GetDtlsCipherStats(), |
1357 kMaxWaitForStatsMs); | 1368 kMaxWaitForStatsMs); |
| 1369 EXPECT_EQ( |
| 1370 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_12), |
| 1371 init_observer.ssl_cipher_["audio"]); |
1358 | 1372 |
1359 EXPECT_EQ_WAIT( | 1373 EXPECT_EQ_WAIT( |
1360 kDefaultSrtpCipher, | 1374 kDefaultSrtpCipher, |
1361 initializing_client()->GetSrtpCipherStats(), | 1375 initializing_client()->GetSrtpCipherStats(), |
1362 kMaxWaitForStatsMs); | 1376 kMaxWaitForStatsMs); |
| 1377 EXPECT_EQ( |
| 1378 kDefaultSrtpCipher, |
| 1379 init_observer.srtp_cipher_["audio"]); |
1363 } | 1380 } |
1364 | 1381 |
1365 // Test that DTLS 1.0 is used if the initator supports DTLS 1.2 and the | 1382 // Test that DTLS 1.0 is used if the initator supports DTLS 1.2 and the |
1366 // received supports 1.0. | 1383 // received supports 1.0. |
1367 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Init) { | 1384 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Init) { |
1368 PeerConnectionFactory::Options init_options; | 1385 PeerConnectionFactory::Options init_options; |
1369 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1386 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
1370 PeerConnectionFactory::Options recv_options; | 1387 PeerConnectionFactory::Options recv_options; |
1371 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1388 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
1372 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); | 1389 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); |
| 1390 webrtc::FakeMetricsObserver init_observer; |
| 1391 initializing_client()->pc()->RegisterUMAObserver(&init_observer); |
1373 LocalP2PTest(); | 1392 LocalP2PTest(); |
1374 | 1393 |
1375 EXPECT_EQ_WAIT( | 1394 EXPECT_EQ_WAIT( |
1376 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), | 1395 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), |
1377 initializing_client()->GetDtlsCipherStats(), | 1396 initializing_client()->GetDtlsCipherStats(), |
1378 kMaxWaitForStatsMs); | 1397 kMaxWaitForStatsMs); |
| 1398 EXPECT_EQ( |
| 1399 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), |
| 1400 init_observer.ssl_cipher_["audio"]); |
1379 | 1401 |
1380 EXPECT_EQ_WAIT( | 1402 EXPECT_EQ_WAIT( |
1381 kDefaultSrtpCipher, | 1403 kDefaultSrtpCipher, |
1382 initializing_client()->GetSrtpCipherStats(), | 1404 initializing_client()->GetSrtpCipherStats(), |
1383 kMaxWaitForStatsMs); | 1405 kMaxWaitForStatsMs); |
| 1406 EXPECT_EQ( |
| 1407 kDefaultSrtpCipher, |
| 1408 init_observer.srtp_cipher_["audio"]); |
1384 } | 1409 } |
1385 | 1410 |
1386 // Test that DTLS 1.0 is used if the initator supports DTLS 1.0 and the | 1411 // Test that DTLS 1.0 is used if the initator supports DTLS 1.0 and the |
1387 // received supports 1.2. | 1412 // received supports 1.2. |
1388 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Recv) { | 1413 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Recv) { |
1389 PeerConnectionFactory::Options init_options; | 1414 PeerConnectionFactory::Options init_options; |
1390 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1415 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
1391 PeerConnectionFactory::Options recv_options; | 1416 PeerConnectionFactory::Options recv_options; |
1392 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1417 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
1393 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); | 1418 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); |
| 1419 webrtc::FakeMetricsObserver init_observer; |
| 1420 initializing_client()->pc()->RegisterUMAObserver(&init_observer); |
1394 LocalP2PTest(); | 1421 LocalP2PTest(); |
1395 | 1422 |
1396 EXPECT_EQ_WAIT( | 1423 EXPECT_EQ_WAIT( |
1397 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), | 1424 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), |
1398 initializing_client()->GetDtlsCipherStats(), | 1425 initializing_client()->GetDtlsCipherStats(), |
1399 kMaxWaitForStatsMs); | 1426 kMaxWaitForStatsMs); |
| 1427 EXPECT_EQ( |
| 1428 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), |
| 1429 init_observer.ssl_cipher_["audio"]); |
1400 | 1430 |
1401 EXPECT_EQ_WAIT( | 1431 EXPECT_EQ_WAIT( |
1402 kDefaultSrtpCipher, | 1432 kDefaultSrtpCipher, |
1403 initializing_client()->GetSrtpCipherStats(), | 1433 initializing_client()->GetSrtpCipherStats(), |
1404 kMaxWaitForStatsMs); | 1434 kMaxWaitForStatsMs); |
| 1435 EXPECT_EQ( |
| 1436 kDefaultSrtpCipher, |
| 1437 init_observer.srtp_cipher_["audio"]); |
1405 } | 1438 } |
1406 | 1439 |
1407 // This test sets up a call between two parties with audio, video and data. | 1440 // This test sets up a call between two parties with audio, video and data. |
1408 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDataChannel) { | 1441 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDataChannel) { |
1409 FakeConstraints setup_constraints; | 1442 FakeConstraints setup_constraints; |
1410 setup_constraints.SetAllowRtpDataChannels(); | 1443 setup_constraints.SetAllowRtpDataChannels(); |
1411 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1444 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
1412 initializing_client()->CreateDataChannel(); | 1445 initializing_client()->CreateDataChannel(); |
1413 LocalP2PTest(); | 1446 LocalP2PTest(); |
1414 ASSERT_TRUE(initializing_client()->data_channel() != NULL); | 1447 ASSERT_TRUE(initializing_client()->data_channel() != NULL); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1576 // TODO(holmer): Disabled due to sometimes crashing on buildbots. | 1609 // TODO(holmer): Disabled due to sometimes crashing on buildbots. |
1577 // See issue webrtc/2378. | 1610 // See issue webrtc/2378. |
1578 TEST_F(JsepPeerConnectionP2PTestClient, | 1611 TEST_F(JsepPeerConnectionP2PTestClient, |
1579 DISABLED_LocalP2PTestWithVideoDecoderFactory) { | 1612 DISABLED_LocalP2PTestWithVideoDecoderFactory) { |
1580 ASSERT_TRUE(CreateTestClients()); | 1613 ASSERT_TRUE(CreateTestClients()); |
1581 EnableVideoDecoderFactory(); | 1614 EnableVideoDecoderFactory(); |
1582 LocalP2PTest(); | 1615 LocalP2PTest(); |
1583 } | 1616 } |
1584 | 1617 |
1585 #endif // if !defined(THREAD_SANITIZER) | 1618 #endif // if !defined(THREAD_SANITIZER) |
OLD | NEW |