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 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 rtc::SSL_PROTOCOL_DTLS_10, rtc::KT_DEFAULT))); | 1443 rtc::SSL_PROTOCOL_DTLS_10, rtc::KT_DEFAULT))); |
1444 | 1444 |
1445 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite), | 1445 EXPECT_EQ_WAIT(rtc::SrtpCryptoSuiteToName(kDefaultSrtpCryptoSuite), |
1446 initializing_client()->GetSrtpCipherStats(), | 1446 initializing_client()->GetSrtpCipherStats(), |
1447 kMaxWaitForStatsMs); | 1447 kMaxWaitForStatsMs); |
1448 EXPECT_EQ(1, | 1448 EXPECT_EQ(1, |
1449 init_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, | 1449 init_observer->GetEnumCounter(webrtc::kEnumCounterAudioSrtpCipher, |
1450 kDefaultSrtpCryptoSuite)); | 1450 kDefaultSrtpCryptoSuite)); |
1451 } | 1451 } |
1452 | 1452 |
1453 // This test sets up a call between two parties with audio, video and data. | 1453 // This test sets up a call between two parties with audio, video and an RTP |
1454 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestDataChannel) { | 1454 // data channel. |
| 1455 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestRtpDataChannel) { |
1455 FakeConstraints setup_constraints; | 1456 FakeConstraints setup_constraints; |
1456 setup_constraints.SetAllowRtpDataChannels(); | 1457 setup_constraints.SetAllowRtpDataChannels(); |
1457 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); | 1458 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); |
1458 initializing_client()->CreateDataChannel(); | 1459 initializing_client()->CreateDataChannel(); |
1459 LocalP2PTest(); | 1460 LocalP2PTest(); |
1460 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); | 1461 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); |
1461 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); | 1462 ASSERT_TRUE(receiving_client()->data_channel() != nullptr); |
1462 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), | 1463 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), |
1463 kMaxWaitMs); | 1464 kMaxWaitMs); |
1464 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), | 1465 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), |
1465 kMaxWaitMs); | 1466 kMaxWaitMs); |
1466 | 1467 |
1467 std::string data = "hello world"; | 1468 std::string data = "hello world"; |
1468 | 1469 |
1469 SendRtpData(initializing_client()->data_channel(), data); | 1470 SendRtpData(initializing_client()->data_channel(), data); |
1470 EXPECT_EQ_WAIT(data, receiving_client()->data_observer()->last_message(), | 1471 EXPECT_EQ_WAIT(data, receiving_client()->data_observer()->last_message(), |
1471 kMaxWaitMs); | 1472 kMaxWaitMs); |
1472 | 1473 |
1473 SendRtpData(receiving_client()->data_channel(), data); | 1474 SendRtpData(receiving_client()->data_channel(), data); |
1474 EXPECT_EQ_WAIT(data, initializing_client()->data_observer()->last_message(), | 1475 EXPECT_EQ_WAIT(data, initializing_client()->data_observer()->last_message(), |
1475 kMaxWaitMs); | 1476 kMaxWaitMs); |
1476 | 1477 |
1477 receiving_client()->data_channel()->Close(); | 1478 receiving_client()->data_channel()->Close(); |
1478 // Send new offer and answer. | 1479 // Send new offer and answer. |
1479 receiving_client()->Negotiate(); | 1480 receiving_client()->Negotiate(); |
1480 EXPECT_FALSE(initializing_client()->data_observer()->IsOpen()); | 1481 EXPECT_FALSE(initializing_client()->data_observer()->IsOpen()); |
1481 EXPECT_FALSE(receiving_client()->data_observer()->IsOpen()); | 1482 EXPECT_FALSE(receiving_client()->data_observer()->IsOpen()); |
1482 } | 1483 } |
1483 | 1484 |
| 1485 // This test sets up a call between two parties with audio, video and an SCTP |
| 1486 // data channel. |
| 1487 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestSctpDataChannel) { |
| 1488 ASSERT_TRUE(CreateTestClients()); |
| 1489 initializing_client()->CreateDataChannel(); |
| 1490 LocalP2PTest(); |
| 1491 ASSERT_TRUE(initializing_client()->data_channel() != nullptr); |
| 1492 EXPECT_TRUE_WAIT(receiving_client()->data_channel() != nullptr, kMaxWaitMs); |
| 1493 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), |
| 1494 kMaxWaitMs); |
| 1495 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), kMaxWaitMs); |
| 1496 |
| 1497 std::string data = "hello world"; |
| 1498 |
| 1499 initializing_client()->data_channel()->Send(DataBuffer(data)); |
| 1500 EXPECT_EQ_WAIT(data, receiving_client()->data_observer()->last_message(), |
| 1501 kMaxWaitMs); |
| 1502 |
| 1503 receiving_client()->data_channel()->Send(DataBuffer(data)); |
| 1504 EXPECT_EQ_WAIT(data, initializing_client()->data_observer()->last_message(), |
| 1505 kMaxWaitMs); |
| 1506 |
| 1507 receiving_client()->data_channel()->Close(); |
| 1508 // Send new offer and answer. |
| 1509 receiving_client()->Negotiate(); |
| 1510 EXPECT_FALSE(initializing_client()->data_observer()->IsOpen()); |
| 1511 EXPECT_FALSE(receiving_client()->data_observer()->IsOpen()); |
| 1512 } |
| 1513 |
1484 // This test sets up a call between two parties and creates a data channel. | 1514 // This test sets up a call between two parties and creates a data channel. |
1485 // The test tests that received data is buffered unless an observer has been | 1515 // The test tests that received data is buffered unless an observer has been |
1486 // registered. | 1516 // registered. |
1487 // Rtp data channels can receive data before the underlying | 1517 // Rtp data channels can receive data before the underlying |
1488 // transport has detected that a channel is writable and thus data can be | 1518 // transport has detected that a channel is writable and thus data can be |
1489 // received before the data channel state changes to open. That is hard to test | 1519 // received before the data channel state changes to open. That is hard to test |
1490 // but the same buffering is used in that case. | 1520 // but the same buffering is used in that case. |
1491 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, RegisterDataChannelObserver) { | 1521 TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, RegisterDataChannelObserver) { |
1492 FakeConstraints setup_constraints; | 1522 FakeConstraints setup_constraints; |
1493 setup_constraints.SetAllowRtpDataChannels(); | 1523 setup_constraints.SetAllowRtpDataChannels(); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1823 server.urls.push_back("stun:hostname"); | 1853 server.urls.push_back("stun:hostname"); |
1824 server.urls.push_back("turn:hostname"); | 1854 server.urls.push_back("turn:hostname"); |
1825 servers.push_back(server); | 1855 servers.push_back(server); |
1826 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_configurations_, | 1856 EXPECT_TRUE(webrtc::ParseIceServers(servers, &stun_configurations_, |
1827 &turn_configurations_)); | 1857 &turn_configurations_)); |
1828 EXPECT_EQ(1U, stun_configurations_.size()); | 1858 EXPECT_EQ(1U, stun_configurations_.size()); |
1829 EXPECT_EQ(1U, turn_configurations_.size()); | 1859 EXPECT_EQ(1U, turn_configurations_.size()); |
1830 } | 1860 } |
1831 | 1861 |
1832 #endif // if !defined(THREAD_SANITIZER) | 1862 #endif // if !defined(THREAD_SANITIZER) |
OLD | NEW |