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

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

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