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 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2062 // Test that GCM isn't used if only the answerer supports it. | 2062 // Test that GCM isn't used if only the answerer supports it. |
2063 TEST_F(PeerConnectionIntegrationTest, | 2063 TEST_F(PeerConnectionIntegrationTest, |
2064 NonGcmCipherUsedWhenOnlyCalleeSupportsGcm) { | 2064 NonGcmCipherUsedWhenOnlyCalleeSupportsGcm) { |
2065 bool local_gcm_enabled = false; | 2065 bool local_gcm_enabled = false; |
2066 bool remote_gcm_enabled = true; | 2066 bool remote_gcm_enabled = true; |
2067 int expected_cipher_suite = kDefaultSrtpCryptoSuite; | 2067 int expected_cipher_suite = kDefaultSrtpCryptoSuite; |
2068 TestGcmNegotiationUsesCipherSuite(local_gcm_enabled, remote_gcm_enabled, | 2068 TestGcmNegotiationUsesCipherSuite(local_gcm_enabled, remote_gcm_enabled, |
2069 expected_cipher_suite); | 2069 expected_cipher_suite); |
2070 } | 2070 } |
2071 | 2071 |
| 2072 // Verify that media can be transmitted end-to-end when GCM crypto suites are |
| 2073 // enabled. Note that the above tests, such as GcmCipherUsedWhenGcmSupported, |
| 2074 // only verify that a GCM cipher is negotiated, and not necessarily that SRTP |
| 2075 // works with it. |
| 2076 TEST_F(PeerConnectionIntegrationTest, EndToEndCallWithGcmCipher) { |
| 2077 PeerConnectionFactory::Options gcm_options; |
| 2078 gcm_options.crypto_options.enable_gcm_crypto_suites = true; |
| 2079 ASSERT_TRUE( |
| 2080 CreatePeerConnectionWrappersWithOptions(gcm_options, gcm_options)); |
| 2081 ConnectFakeSignaling(); |
| 2082 // Do normal offer/answer and wait for some frames to be received in each |
| 2083 // direction. |
| 2084 caller()->AddAudioVideoMediaStream(); |
| 2085 callee()->AddAudioVideoMediaStream(); |
| 2086 caller()->CreateAndSetAndSignalOffer(); |
| 2087 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
| 2088 ExpectNewFramesReceivedWithWait( |
| 2089 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, |
| 2090 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, |
| 2091 kMaxWaitForFramesMs); |
| 2092 } |
| 2093 |
2072 // This test sets up a call between two parties with audio, video and an RTP | 2094 // This test sets up a call between two parties with audio, video and an RTP |
2073 // data channel. | 2095 // data channel. |
2074 TEST_F(PeerConnectionIntegrationTest, EndToEndCallWithRtpDataChannel) { | 2096 TEST_F(PeerConnectionIntegrationTest, EndToEndCallWithRtpDataChannel) { |
2075 FakeConstraints setup_constraints; | 2097 FakeConstraints setup_constraints; |
2076 setup_constraints.SetAllowRtpDataChannels(); | 2098 setup_constraints.SetAllowRtpDataChannels(); |
2077 ASSERT_TRUE(CreatePeerConnectionWrappersWithConstraints(&setup_constraints, | 2099 ASSERT_TRUE(CreatePeerConnectionWrappersWithConstraints(&setup_constraints, |
2078 &setup_constraints)); | 2100 &setup_constraints)); |
2079 ConnectFakeSignaling(); | 2101 ConnectFakeSignaling(); |
2080 // Expect that data channel created on caller side will show up for callee as | 2102 // Expect that data channel created on caller side will show up for callee as |
2081 // well. | 2103 // well. |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2378 // Ensure data can be sent in both directions. | 2400 // Ensure data can be sent in both directions. |
2379 std::string data = "hello world"; | 2401 std::string data = "hello world"; |
2380 caller()->data_channel()->Send(DataBuffer(data)); | 2402 caller()->data_channel()->Send(DataBuffer(data)); |
2381 EXPECT_EQ_WAIT(data, callee()->data_observer()->last_message(), | 2403 EXPECT_EQ_WAIT(data, callee()->data_observer()->last_message(), |
2382 kDefaultTimeout); | 2404 kDefaultTimeout); |
2383 callee()->data_channel()->Send(DataBuffer(data)); | 2405 callee()->data_channel()->Send(DataBuffer(data)); |
2384 EXPECT_EQ_WAIT(data, caller()->data_observer()->last_message(), | 2406 EXPECT_EQ_WAIT(data, caller()->data_observer()->last_message(), |
2385 kDefaultTimeout); | 2407 kDefaultTimeout); |
2386 } | 2408 } |
2387 | 2409 |
| 2410 // Set up a connection initially just using SCTP data channels, later upgrading |
| 2411 // to audio/video, ensuring frames are received end-to-end. Effectively the |
| 2412 // inverse of the test above. |
| 2413 // This was broken in M57; see https://crbug.com/711243 |
| 2414 TEST_F(PeerConnectionIntegrationTest, SctpDataChannelToAudioVideoUpgrade) { |
| 2415 ASSERT_TRUE(CreatePeerConnectionWrappers()); |
| 2416 ConnectFakeSignaling(); |
| 2417 // Do initial offer/answer with just data channel. |
| 2418 caller()->CreateDataChannel(); |
| 2419 caller()->CreateAndSetAndSignalOffer(); |
| 2420 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
| 2421 // Wait until data can be sent over the data channel. |
| 2422 ASSERT_TRUE_WAIT(callee()->data_channel() != nullptr, kDefaultTimeout); |
| 2423 ASSERT_TRUE_WAIT(caller()->data_observer()->IsOpen(), kDefaultTimeout); |
| 2424 ASSERT_TRUE_WAIT(callee()->data_observer()->IsOpen(), kDefaultTimeout); |
| 2425 |
| 2426 // Do subsequent offer/answer with two-way audio and video. Audio and video |
| 2427 // should end up bundled on the DTLS/ICE transport already used for data. |
| 2428 caller()->AddAudioVideoMediaStream(); |
| 2429 callee()->AddAudioVideoMediaStream(); |
| 2430 caller()->CreateAndSetAndSignalOffer(); |
| 2431 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
| 2432 ExpectNewFramesReceivedWithWait( |
| 2433 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, |
| 2434 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, |
| 2435 kMaxWaitForFramesMs); |
| 2436 } |
| 2437 |
2388 #endif // HAVE_SCTP | 2438 #endif // HAVE_SCTP |
2389 | 2439 |
2390 // Test that the ICE connection and gathering states eventually reach | 2440 // Test that the ICE connection and gathering states eventually reach |
2391 // "complete". | 2441 // "complete". |
2392 TEST_F(PeerConnectionIntegrationTest, IceStatesReachCompletion) { | 2442 TEST_F(PeerConnectionIntegrationTest, IceStatesReachCompletion) { |
2393 ASSERT_TRUE(CreatePeerConnectionWrappers()); | 2443 ASSERT_TRUE(CreatePeerConnectionWrappers()); |
2394 ConnectFakeSignaling(); | 2444 ConnectFakeSignaling(); |
2395 // Do normal offer/answer. | 2445 // Do normal offer/answer. |
2396 caller()->AddAudioVideoMediaStream(); | 2446 caller()->AddAudioVideoMediaStream(); |
2397 callee()->AddAudioVideoMediaStream(); | 2447 callee()->AddAudioVideoMediaStream(); |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2850 caller()->CreateAndSetAndSignalOffer(); | 2900 caller()->CreateAndSetAndSignalOffer(); |
2851 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); | 2901 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
2852 // Wait for additional audio frames to be received by the callee. | 2902 // Wait for additional audio frames to be received by the callee. |
2853 ExpectNewFramesReceivedWithWait(0, 0, kDefaultExpectedAudioFrameCount, 0, | 2903 ExpectNewFramesReceivedWithWait(0, 0, kDefaultExpectedAudioFrameCount, 0, |
2854 kMaxWaitForFramesMs); | 2904 kMaxWaitForFramesMs); |
2855 } | 2905 } |
2856 | 2906 |
2857 } // namespace | 2907 } // namespace |
2858 | 2908 |
2859 #endif // if !defined(THREAD_SANITIZER) | 2909 #endif // if !defined(THREAD_SANITIZER) |
OLD | NEW |