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.peer_connection_metrics_name_string_ |
| 1344 [webrtc::kAudioSslCipher]); |
1338 | 1345 |
1339 EXPECT_EQ_WAIT( | 1346 EXPECT_EQ_WAIT( |
1340 kDefaultSrtpCipher, | 1347 kDefaultSrtpCipher, |
1341 initializing_client()->GetSrtpCipherStats(), | 1348 initializing_client()->GetSrtpCipherStats(), |
1342 kMaxWaitForStatsMs); | 1349 kMaxWaitForStatsMs); |
| 1350 EXPECT_EQ( |
| 1351 kDefaultSrtpCipher, |
| 1352 init_observer.peer_connection_metrics_name_string_ |
| 1353 [webrtc::kAudioSrtpCipher]); |
1343 } | 1354 } |
1344 | 1355 |
1345 // Test that DTLS 1.2 is used if both ends support it. | 1356 // Test that DTLS 1.2 is used if both ends support it. |
1346 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Both) { | 1357 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Both) { |
1347 PeerConnectionFactory::Options init_options; | 1358 PeerConnectionFactory::Options init_options; |
1348 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1359 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
1349 PeerConnectionFactory::Options recv_options; | 1360 PeerConnectionFactory::Options recv_options; |
1350 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1361 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
1351 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); | 1362 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); |
| 1363 webrtc::FakeMetricsObserver init_observer; |
| 1364 initializing_client()->pc()->RegisterUMAObserver(&init_observer); |
1352 LocalP2PTest(); | 1365 LocalP2PTest(); |
1353 | 1366 |
1354 EXPECT_EQ_WAIT( | 1367 EXPECT_EQ_WAIT( |
1355 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_12), | 1368 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_12), |
1356 initializing_client()->GetDtlsCipherStats(), | 1369 initializing_client()->GetDtlsCipherStats(), |
1357 kMaxWaitForStatsMs); | 1370 kMaxWaitForStatsMs); |
| 1371 EXPECT_EQ( |
| 1372 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_12), |
| 1373 init_observer.peer_connection_metrics_name_string_ |
| 1374 [webrtc::kAudioSslCipher]); |
1358 | 1375 |
1359 EXPECT_EQ_WAIT( | 1376 EXPECT_EQ_WAIT( |
1360 kDefaultSrtpCipher, | 1377 kDefaultSrtpCipher, |
1361 initializing_client()->GetSrtpCipherStats(), | 1378 initializing_client()->GetSrtpCipherStats(), |
1362 kMaxWaitForStatsMs); | 1379 kMaxWaitForStatsMs); |
| 1380 EXPECT_EQ( |
| 1381 kDefaultSrtpCipher, |
| 1382 init_observer.peer_connection_metrics_name_string_ |
| 1383 [webrtc::kAudioSrtpCipher]); |
1363 } | 1384 } |
1364 | 1385 |
1365 // Test that DTLS 1.0 is used if the initator supports DTLS 1.2 and the | 1386 // Test that DTLS 1.0 is used if the initator supports DTLS 1.2 and the |
1366 // received supports 1.0. | 1387 // received supports 1.0. |
1367 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Init) { | 1388 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Init) { |
1368 PeerConnectionFactory::Options init_options; | 1389 PeerConnectionFactory::Options init_options; |
1369 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1390 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
1370 PeerConnectionFactory::Options recv_options; | 1391 PeerConnectionFactory::Options recv_options; |
1371 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1392 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
1372 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); | 1393 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); |
| 1394 webrtc::FakeMetricsObserver init_observer; |
| 1395 initializing_client()->pc()->RegisterUMAObserver(&init_observer); |
1373 LocalP2PTest(); | 1396 LocalP2PTest(); |
1374 | 1397 |
1375 EXPECT_EQ_WAIT( | 1398 EXPECT_EQ_WAIT( |
1376 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), | 1399 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), |
1377 initializing_client()->GetDtlsCipherStats(), | 1400 initializing_client()->GetDtlsCipherStats(), |
1378 kMaxWaitForStatsMs); | 1401 kMaxWaitForStatsMs); |
| 1402 EXPECT_EQ( |
| 1403 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), |
| 1404 init_observer.peer_connection_metrics_name_string_ |
| 1405 [webrtc::kAudioSslCipher]); |
1379 | 1406 |
1380 EXPECT_EQ_WAIT( | 1407 EXPECT_EQ_WAIT( |
1381 kDefaultSrtpCipher, | 1408 kDefaultSrtpCipher, |
1382 initializing_client()->GetSrtpCipherStats(), | 1409 initializing_client()->GetSrtpCipherStats(), |
1383 kMaxWaitForStatsMs); | 1410 kMaxWaitForStatsMs); |
| 1411 EXPECT_EQ( |
| 1412 kDefaultSrtpCipher, |
| 1413 init_observer.peer_connection_metrics_name_string_ |
| 1414 [webrtc::kAudioSrtpCipher]); |
1384 } | 1415 } |
1385 | 1416 |
1386 // Test that DTLS 1.0 is used if the initator supports DTLS 1.0 and the | 1417 // Test that DTLS 1.0 is used if the initator supports DTLS 1.0 and the |
1387 // received supports 1.2. | 1418 // received supports 1.2. |
1388 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Recv) { | 1419 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Recv) { |
1389 PeerConnectionFactory::Options init_options; | 1420 PeerConnectionFactory::Options init_options; |
1390 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; | 1421 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; |
1391 PeerConnectionFactory::Options recv_options; | 1422 PeerConnectionFactory::Options recv_options; |
1392 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; | 1423 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; |
1393 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); | 1424 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); |
| 1425 webrtc::FakeMetricsObserver init_observer; |
| 1426 initializing_client()->pc()->RegisterUMAObserver(&init_observer); |
1394 LocalP2PTest(); | 1427 LocalP2PTest(); |
1395 | 1428 |
1396 EXPECT_EQ_WAIT( | 1429 EXPECT_EQ_WAIT( |
1397 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), | 1430 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), |
1398 initializing_client()->GetDtlsCipherStats(), | 1431 initializing_client()->GetDtlsCipherStats(), |
1399 kMaxWaitForStatsMs); | 1432 kMaxWaitForStatsMs); |
| 1433 EXPECT_EQ( |
| 1434 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10), |
| 1435 init_observer.peer_connection_metrics_name_string_ |
| 1436 [webrtc::kAudioSslCipher]); |
1400 | 1437 |
1401 EXPECT_EQ_WAIT( | 1438 EXPECT_EQ_WAIT( |
1402 kDefaultSrtpCipher, | 1439 kDefaultSrtpCipher, |
1403 initializing_client()->GetSrtpCipherStats(), | 1440 initializing_client()->GetSrtpCipherStats(), |
1404 kMaxWaitForStatsMs); | 1441 kMaxWaitForStatsMs); |
| 1442 EXPECT_EQ( |
| 1443 kDefaultSrtpCipher, |
| 1444 init_observer.peer_connection_metrics_name_string_ |
| 1445 [webrtc::kAudioSrtpCipher]); |
1405 } | 1446 } |
1406 | 1447 |
1407 // This test sets up a call between two parties with audio, video and data. | 1448 // This test sets up a call between two parties with audio, video and data. |
1408 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDataChannel) { | 1449 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDataChannel) { |
1409 FakeConstraints setup_constraints; | 1450 FakeConstraints setup_constraints; |
1410 setup_constraints.SetAllowRtpDataChannels(); | 1451 setup_constraints.SetAllowRtpDataChannels(); |
1411 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1452 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
1412 initializing_client()->CreateDataChannel(); | 1453 initializing_client()->CreateDataChannel(); |
1413 LocalP2PTest(); | 1454 LocalP2PTest(); |
1414 ASSERT_TRUE(initializing_client()->data_channel() != NULL); | 1455 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. | 1617 // TODO(holmer): Disabled due to sometimes crashing on buildbots. |
1577 // See issue webrtc/2378. | 1618 // See issue webrtc/2378. |
1578 TEST_F(JsepPeerConnectionP2PTestClient, | 1619 TEST_F(JsepPeerConnectionP2PTestClient, |
1579 DISABLED_LocalP2PTestWithVideoDecoderFactory) { | 1620 DISABLED_LocalP2PTestWithVideoDecoderFactory) { |
1580 ASSERT_TRUE(CreateTestClients()); | 1621 ASSERT_TRUE(CreateTestClients()); |
1581 EnableVideoDecoderFactory(); | 1622 EnableVideoDecoderFactory(); |
1582 LocalP2PTest(); | 1623 LocalP2PTest(); |
1583 } | 1624 } |
1584 | 1625 |
1585 #endif // if !defined(THREAD_SANITIZER) | 1626 #endif // if !defined(THREAD_SANITIZER) |
OLD | NEW |