OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2013 // Test that GCM isn't used if only the answerer supports it. | 2013 // Test that GCM isn't used if only the answerer supports it. |
2014 TEST_F(PeerConnectionIntegrationTest, | 2014 TEST_F(PeerConnectionIntegrationTest, |
2015 NonGcmCipherUsedWhenOnlyCalleeSupportsGcm) { | 2015 NonGcmCipherUsedWhenOnlyCalleeSupportsGcm) { |
2016 bool local_gcm_enabled = false; | 2016 bool local_gcm_enabled = false; |
2017 bool remote_gcm_enabled = true; | 2017 bool remote_gcm_enabled = true; |
2018 int expected_cipher_suite = kDefaultSrtpCryptoSuite; | 2018 int expected_cipher_suite = kDefaultSrtpCryptoSuite; |
2019 TestGcmNegotiationUsesCipherSuite(local_gcm_enabled, remote_gcm_enabled, | 2019 TestGcmNegotiationUsesCipherSuite(local_gcm_enabled, remote_gcm_enabled, |
2020 expected_cipher_suite); | 2020 expected_cipher_suite); |
2021 } | 2021 } |
2022 | 2022 |
| 2023 // Verify that media can be transmitted end-to-end when GCM crypto suites are |
| 2024 // enabled. Note that the above tests, such as GcmCipherUsedWhenGcmSupported, |
| 2025 // only verify that a GCM cipher is negotiated, and not necessarily that SRTP |
| 2026 // works with it. |
| 2027 TEST_F(PeerConnectionIntegrationTest, EndToEndCallWithGcmCipher) { |
| 2028 PeerConnectionFactory::Options gcm_options; |
| 2029 gcm_options.crypto_options.enable_gcm_crypto_suites = true; |
| 2030 ASSERT_TRUE( |
| 2031 CreatePeerConnectionWrappersWithOptions(gcm_options, gcm_options)); |
| 2032 ConnectFakeSignaling(); |
| 2033 // Do normal offer/answer and wait for some frames to be received in each |
| 2034 // direction. |
| 2035 caller()->AddAudioVideoMediaStream(); |
| 2036 callee()->AddAudioVideoMediaStream(); |
| 2037 caller()->CreateAndSetAndSignalOffer(); |
| 2038 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
| 2039 ExpectNewFramesReceivedWithWait( |
| 2040 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, |
| 2041 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, |
| 2042 kMaxWaitForFramesMs); |
| 2043 } |
| 2044 |
2023 // This test sets up a call between two parties with audio, video and an RTP | 2045 // This test sets up a call between two parties with audio, video and an RTP |
2024 // data channel. | 2046 // data channel. |
2025 TEST_F(PeerConnectionIntegrationTest, EndToEndCallWithRtpDataChannel) { | 2047 TEST_F(PeerConnectionIntegrationTest, EndToEndCallWithRtpDataChannel) { |
2026 FakeConstraints setup_constraints; | 2048 FakeConstraints setup_constraints; |
2027 setup_constraints.SetAllowRtpDataChannels(); | 2049 setup_constraints.SetAllowRtpDataChannels(); |
2028 ASSERT_TRUE(CreatePeerConnectionWrappersWithConstraints(&setup_constraints, | 2050 ASSERT_TRUE(CreatePeerConnectionWrappersWithConstraints(&setup_constraints, |
2029 &setup_constraints)); | 2051 &setup_constraints)); |
2030 ConnectFakeSignaling(); | 2052 ConnectFakeSignaling(); |
2031 // Expect that data channel created on caller side will show up for callee as | 2053 // Expect that data channel created on caller side will show up for callee as |
2032 // well. | 2054 // well. |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2329 // Ensure data can be sent in both directions. | 2351 // Ensure data can be sent in both directions. |
2330 std::string data = "hello world"; | 2352 std::string data = "hello world"; |
2331 caller()->data_channel()->Send(DataBuffer(data)); | 2353 caller()->data_channel()->Send(DataBuffer(data)); |
2332 EXPECT_EQ_WAIT(data, callee()->data_observer()->last_message(), | 2354 EXPECT_EQ_WAIT(data, callee()->data_observer()->last_message(), |
2333 kDefaultTimeout); | 2355 kDefaultTimeout); |
2334 callee()->data_channel()->Send(DataBuffer(data)); | 2356 callee()->data_channel()->Send(DataBuffer(data)); |
2335 EXPECT_EQ_WAIT(data, caller()->data_observer()->last_message(), | 2357 EXPECT_EQ_WAIT(data, caller()->data_observer()->last_message(), |
2336 kDefaultTimeout); | 2358 kDefaultTimeout); |
2337 } | 2359 } |
2338 | 2360 |
| 2361 // Set up a connection initially just using SCTP data channels, later upgrading |
| 2362 // to audio/video, ensuring frames are received end-to-end. Effectively the |
| 2363 // inverse of the test above. |
| 2364 // This was broken in M57; see https://crbug.com/711243 |
| 2365 TEST_F(PeerConnectionIntegrationTest, SctpDataChannelToAudioVideoUpgrade) { |
| 2366 ASSERT_TRUE(CreatePeerConnectionWrappers()); |
| 2367 ConnectFakeSignaling(); |
| 2368 // Do initial offer/answer with just data channel. |
| 2369 caller()->CreateDataChannel(); |
| 2370 caller()->CreateAndSetAndSignalOffer(); |
| 2371 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
| 2372 // Wait until data can be sent over the data channel. |
| 2373 ASSERT_TRUE_WAIT(callee()->data_channel() != nullptr, kDefaultTimeout); |
| 2374 ASSERT_TRUE_WAIT(caller()->data_observer()->IsOpen(), kDefaultTimeout); |
| 2375 ASSERT_TRUE_WAIT(callee()->data_observer()->IsOpen(), kDefaultTimeout); |
| 2376 |
| 2377 // Do subsequent offer/answer with two-way audio and video. Audio and video |
| 2378 // should end up bundled on the DTLS/ICE transport already used for data. |
| 2379 caller()->AddAudioVideoMediaStream(); |
| 2380 callee()->AddAudioVideoMediaStream(); |
| 2381 caller()->CreateAndSetAndSignalOffer(); |
| 2382 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
| 2383 ExpectNewFramesReceivedWithWait( |
| 2384 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, |
| 2385 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, |
| 2386 kMaxWaitForFramesMs); |
| 2387 } |
| 2388 |
2339 #endif // HAVE_SCTP | 2389 #endif // HAVE_SCTP |
2340 | 2390 |
2341 // Test that the ICE connection and gathering states eventually reach | 2391 // Test that the ICE connection and gathering states eventually reach |
2342 // "complete". | 2392 // "complete". |
2343 TEST_F(PeerConnectionIntegrationTest, IceStatesReachCompletion) { | 2393 TEST_F(PeerConnectionIntegrationTest, IceStatesReachCompletion) { |
2344 ASSERT_TRUE(CreatePeerConnectionWrappers()); | 2394 ASSERT_TRUE(CreatePeerConnectionWrappers()); |
2345 ConnectFakeSignaling(); | 2395 ConnectFakeSignaling(); |
2346 // Do normal offer/answer. | 2396 // Do normal offer/answer. |
2347 caller()->AddAudioVideoMediaStream(); | 2397 caller()->AddAudioVideoMediaStream(); |
2348 callee()->AddAudioVideoMediaStream(); | 2398 callee()->AddAudioVideoMediaStream(); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2769 | 2819 |
2770 auto contributing_sources = receiver->GetSources(); | 2820 auto contributing_sources = receiver->GetSources(); |
2771 ASSERT_GT(receiver->GetParameters().encodings.size(), 0u); | 2821 ASSERT_GT(receiver->GetParameters().encodings.size(), 0u); |
2772 EXPECT_EQ(receiver->GetParameters().encodings[0].ssrc, | 2822 EXPECT_EQ(receiver->GetParameters().encodings[0].ssrc, |
2773 contributing_sources[0].source_id()); | 2823 contributing_sources[0].source_id()); |
2774 } | 2824 } |
2775 | 2825 |
2776 } // namespace | 2826 } // namespace |
2777 | 2827 |
2778 #endif // if !defined(THREAD_SANITIZER) | 2828 #endif // if !defined(THREAD_SANITIZER) |
OLD | NEW |