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

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

Issue 1380603005: Revert of Change WebRTC SslCipher to be exposed as number only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 2 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/fakemetricsobserver.cc ('k') | talk/app/webrtc/peerconnectioninterface.h » ('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 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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 PeerConnectionFactory::Options init_options; 1335 PeerConnectionFactory::Options init_options;
1336 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; 1336 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10;
1337 PeerConnectionFactory::Options recv_options; 1337 PeerConnectionFactory::Options recv_options;
1338 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; 1338 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10;
1339 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); 1339 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options));
1340 rtc::scoped_refptr<webrtc::FakeMetricsObserver> 1340 rtc::scoped_refptr<webrtc::FakeMetricsObserver>
1341 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); 1341 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>();
1342 initializing_client()->pc()->RegisterUMAObserver(init_observer); 1342 initializing_client()->pc()->RegisterUMAObserver(init_observer);
1343 LocalP2PTest(); 1343 LocalP2PTest();
1344 1344
1345 EXPECT_EQ_WAIT(rtc::SSLStreamAdapter::GetSslCipherSuiteName( 1345 EXPECT_EQ_WAIT(
1346 rtc::SSLStreamAdapter::GetDefaultSslCipherForTest( 1346 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10),
1347 rtc::SSL_PROTOCOL_DTLS_10, rtc::KT_DEFAULT)), 1347 initializing_client()->GetDtlsCipherStats(),
1348 initializing_client()->GetDtlsCipherStats(), 1348 kMaxWaitForStatsMs);
1349 kMaxWaitForStatsMs); 1349 EXPECT_EQ(
1350 EXPECT_EQ(1, init_observer->GetEnumCounter( 1350 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10),
1351 webrtc::kEnumCounterAudioSslCipher, 1351 init_observer->GetStringHistogramSample(webrtc::kAudioSslCipher));
1352 rtc::SSLStreamAdapter::GetDefaultSslCipherForTest(
1353 rtc::SSL_PROTOCOL_DTLS_10, rtc::KT_DEFAULT)));
1354 1352
1355 EXPECT_EQ_WAIT(kDefaultSrtpCipher, 1353 EXPECT_EQ_WAIT(
1356 initializing_client()->GetSrtpCipherStats(), 1354 kDefaultSrtpCipher,
1357 kMaxWaitForStatsMs); 1355 initializing_client()->GetSrtpCipherStats(),
1358 EXPECT_EQ(1, init_observer->GetEnumCounter( 1356 kMaxWaitForStatsMs);
1359 webrtc::kEnumCounterAudioSrtpCipher, 1357 EXPECT_EQ(
1360 rtc::GetSrtpCryptoSuiteFromName(kDefaultSrtpCipher))); 1358 kDefaultSrtpCipher,
1359 init_observer->GetStringHistogramSample(webrtc::kAudioSrtpCipher));
1361 } 1360 }
1362 1361
1363 // Test that DTLS 1.2 is used if both ends support it. 1362 // Test that DTLS 1.2 is used if both ends support it.
1364 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Both) { 1363 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Both) {
1365 PeerConnectionFactory::Options init_options; 1364 PeerConnectionFactory::Options init_options;
1366 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; 1365 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12;
1367 PeerConnectionFactory::Options recv_options; 1366 PeerConnectionFactory::Options recv_options;
1368 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; 1367 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12;
1369 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); 1368 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options));
1370 rtc::scoped_refptr<webrtc::FakeMetricsObserver> 1369 rtc::scoped_refptr<webrtc::FakeMetricsObserver>
1371 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); 1370 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>();
1372 initializing_client()->pc()->RegisterUMAObserver(init_observer); 1371 initializing_client()->pc()->RegisterUMAObserver(init_observer);
1373 LocalP2PTest(); 1372 LocalP2PTest();
1374 1373
1375 EXPECT_EQ_WAIT(rtc::SSLStreamAdapter::GetSslCipherSuiteName( 1374 EXPECT_EQ_WAIT(
1376 rtc::SSLStreamAdapter::GetDefaultSslCipherForTest( 1375 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_12),
1377 rtc::SSL_PROTOCOL_DTLS_12, rtc::KT_DEFAULT)), 1376 initializing_client()->GetDtlsCipherStats(),
1378 initializing_client()->GetDtlsCipherStats(), 1377 kMaxWaitForStatsMs);
1379 kMaxWaitForStatsMs); 1378 EXPECT_EQ(
1380 EXPECT_EQ(1, init_observer->GetEnumCounter( 1379 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_12),
1381 webrtc::kEnumCounterAudioSslCipher, 1380 init_observer->GetStringHistogramSample(webrtc::kAudioSslCipher));
1382 rtc::SSLStreamAdapter::GetDefaultSslCipherForTest(
1383 rtc::SSL_PROTOCOL_DTLS_12, rtc::KT_DEFAULT)));
1384 1381
1385 EXPECT_EQ_WAIT(kDefaultSrtpCipher, 1382 EXPECT_EQ_WAIT(
1386 initializing_client()->GetSrtpCipherStats(), 1383 kDefaultSrtpCipher,
1387 kMaxWaitForStatsMs); 1384 initializing_client()->GetSrtpCipherStats(),
1388 EXPECT_EQ(1, init_observer->GetEnumCounter( 1385 kMaxWaitForStatsMs);
1389 webrtc::kEnumCounterAudioSrtpCipher, 1386 EXPECT_EQ(
1390 rtc::GetSrtpCryptoSuiteFromName(kDefaultSrtpCipher))); 1387 kDefaultSrtpCipher,
1388 init_observer->GetStringHistogramSample(webrtc::kAudioSrtpCipher));
1391 } 1389 }
1392 1390
1393 // Test that DTLS 1.0 is used if the initator supports DTLS 1.2 and the 1391 // Test that DTLS 1.0 is used if the initator supports DTLS 1.2 and the
1394 // received supports 1.0. 1392 // received supports 1.0.
1395 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Init) { 1393 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Init) {
1396 PeerConnectionFactory::Options init_options; 1394 PeerConnectionFactory::Options init_options;
1397 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; 1395 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12;
1398 PeerConnectionFactory::Options recv_options; 1396 PeerConnectionFactory::Options recv_options;
1399 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; 1397 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10;
1400 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); 1398 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options));
1401 rtc::scoped_refptr<webrtc::FakeMetricsObserver> 1399 rtc::scoped_refptr<webrtc::FakeMetricsObserver>
1402 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); 1400 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>();
1403 initializing_client()->pc()->RegisterUMAObserver(init_observer); 1401 initializing_client()->pc()->RegisterUMAObserver(init_observer);
1404 LocalP2PTest(); 1402 LocalP2PTest();
1405 1403
1406 EXPECT_EQ_WAIT(rtc::SSLStreamAdapter::GetSslCipherSuiteName( 1404 EXPECT_EQ_WAIT(
1407 rtc::SSLStreamAdapter::GetDefaultSslCipherForTest( 1405 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10),
1408 rtc::SSL_PROTOCOL_DTLS_10, rtc::KT_DEFAULT)), 1406 initializing_client()->GetDtlsCipherStats(),
1409 initializing_client()->GetDtlsCipherStats(), 1407 kMaxWaitForStatsMs);
1410 kMaxWaitForStatsMs); 1408 EXPECT_EQ(
1411 EXPECT_EQ(1, init_observer->GetEnumCounter( 1409 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10),
1412 webrtc::kEnumCounterAudioSslCipher, 1410 init_observer->GetStringHistogramSample(webrtc::kAudioSslCipher));
1413 rtc::SSLStreamAdapter::GetDefaultSslCipherForTest(
1414 rtc::SSL_PROTOCOL_DTLS_10, rtc::KT_DEFAULT)));
1415 1411
1416 EXPECT_EQ_WAIT(kDefaultSrtpCipher, 1412 EXPECT_EQ_WAIT(
1417 initializing_client()->GetSrtpCipherStats(), 1413 kDefaultSrtpCipher,
1418 kMaxWaitForStatsMs); 1414 initializing_client()->GetSrtpCipherStats(),
1419 EXPECT_EQ(1, init_observer->GetEnumCounter( 1415 kMaxWaitForStatsMs);
1420 webrtc::kEnumCounterAudioSrtpCipher, 1416 EXPECT_EQ(
1421 rtc::GetSrtpCryptoSuiteFromName(kDefaultSrtpCipher))); 1417 kDefaultSrtpCipher,
1418 init_observer->GetStringHistogramSample(webrtc::kAudioSrtpCipher));
1422 } 1419 }
1423 1420
1424 // Test that DTLS 1.0 is used if the initator supports DTLS 1.0 and the 1421 // Test that DTLS 1.0 is used if the initator supports DTLS 1.0 and the
1425 // received supports 1.2. 1422 // received supports 1.2.
1426 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Recv) { 1423 TEST_F(JsepPeerConnectionP2PTestClient, GetDtls12Recv) {
1427 PeerConnectionFactory::Options init_options; 1424 PeerConnectionFactory::Options init_options;
1428 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10; 1425 init_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_10;
1429 PeerConnectionFactory::Options recv_options; 1426 PeerConnectionFactory::Options recv_options;
1430 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12; 1427 recv_options.ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12;
1431 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options)); 1428 ASSERT_TRUE(CreateTestClients(NULL, &init_options, NULL, &recv_options));
1432 rtc::scoped_refptr<webrtc::FakeMetricsObserver> 1429 rtc::scoped_refptr<webrtc::FakeMetricsObserver>
1433 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>(); 1430 init_observer = new rtc::RefCountedObject<webrtc::FakeMetricsObserver>();
1434 initializing_client()->pc()->RegisterUMAObserver(init_observer); 1431 initializing_client()->pc()->RegisterUMAObserver(init_observer);
1435 LocalP2PTest(); 1432 LocalP2PTest();
1436 1433
1437 EXPECT_EQ_WAIT(rtc::SSLStreamAdapter::GetSslCipherSuiteName( 1434 EXPECT_EQ_WAIT(
1438 rtc::SSLStreamAdapter::GetDefaultSslCipherForTest( 1435 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10),
1439 rtc::SSL_PROTOCOL_DTLS_10, rtc::KT_DEFAULT)), 1436 initializing_client()->GetDtlsCipherStats(),
1440 initializing_client()->GetDtlsCipherStats(), 1437 kMaxWaitForStatsMs);
1441 kMaxWaitForStatsMs); 1438 EXPECT_EQ(
1442 EXPECT_EQ(1, init_observer->GetEnumCounter( 1439 rtc::SSLStreamAdapter::GetDefaultSslCipher(rtc::SSL_PROTOCOL_DTLS_10),
1443 webrtc::kEnumCounterAudioSslCipher, 1440 init_observer->GetStringHistogramSample(webrtc::kAudioSslCipher));
1444 rtc::SSLStreamAdapter::GetDefaultSslCipherForTest(
1445 rtc::SSL_PROTOCOL_DTLS_10, rtc::KT_DEFAULT)));
1446 1441
1447 EXPECT_EQ_WAIT(kDefaultSrtpCipher, 1442 EXPECT_EQ_WAIT(
1448 initializing_client()->GetSrtpCipherStats(), 1443 kDefaultSrtpCipher,
1449 kMaxWaitForStatsMs); 1444 initializing_client()->GetSrtpCipherStats(),
1450 EXPECT_EQ(1, init_observer->GetEnumCounter( 1445 kMaxWaitForStatsMs);
1451 webrtc::kEnumCounterAudioSrtpCipher, 1446 EXPECT_EQ(
1452 rtc::GetSrtpCryptoSuiteFromName(kDefaultSrtpCipher))); 1447 kDefaultSrtpCipher,
1448 init_observer->GetStringHistogramSample(webrtc::kAudioSrtpCipher));
1453 } 1449 }
1454 1450
1455 // This test sets up a call between two parties with audio, video and data. 1451 // This test sets up a call between two parties with audio, video and data.
1456 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDataChannel) { 1452 TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestDataChannel) {
1457 FakeConstraints setup_constraints; 1453 FakeConstraints setup_constraints;
1458 setup_constraints.SetAllowRtpDataChannels(); 1454 setup_constraints.SetAllowRtpDataChannels();
1459 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); 1455 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints));
1460 initializing_client()->CreateDataChannel(); 1456 initializing_client()->CreateDataChannel();
1461 LocalP2PTest(); 1457 LocalP2PTest();
1462 ASSERT_TRUE(initializing_client()->data_channel() != NULL); 1458 ASSERT_TRUE(initializing_client()->data_channel() != NULL);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 // TODO(holmer): Disabled due to sometimes crashing on buildbots. 1620 // TODO(holmer): Disabled due to sometimes crashing on buildbots.
1625 // See issue webrtc/2378. 1621 // See issue webrtc/2378.
1626 TEST_F(JsepPeerConnectionP2PTestClient, 1622 TEST_F(JsepPeerConnectionP2PTestClient,
1627 DISABLED_LocalP2PTestWithVideoDecoderFactory) { 1623 DISABLED_LocalP2PTestWithVideoDecoderFactory) {
1628 ASSERT_TRUE(CreateTestClients()); 1624 ASSERT_TRUE(CreateTestClients());
1629 EnableVideoDecoderFactory(); 1625 EnableVideoDecoderFactory();
1630 LocalP2PTest(); 1626 LocalP2PTest();
1631 } 1627 }
1632 1628
1633 #endif // if !defined(THREAD_SANITIZER) 1629 #endif // if !defined(THREAD_SANITIZER)
OLDNEW
« no previous file with comments | « talk/app/webrtc/fakemetricsobserver.cc ('k') | talk/app/webrtc/peerconnectioninterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698