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 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2475 caller()->AddAudioVideoMediaStream(); | 2475 caller()->AddAudioVideoMediaStream(); |
2476 callee()->AddAudioVideoMediaStream(); | 2476 callee()->AddAudioVideoMediaStream(); |
2477 caller()->CreateAndSetAndSignalOffer(); | 2477 caller()->CreateAndSetAndSignalOffer(); |
2478 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); | 2478 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
2479 ExpectNewFramesReceivedWithWait( | 2479 ExpectNewFramesReceivedWithWait( |
2480 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, | 2480 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, |
2481 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, | 2481 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, |
2482 kMaxWaitForFramesMs); | 2482 kMaxWaitForFramesMs); |
2483 } | 2483 } |
2484 | 2484 |
| 2485 static void MakeSpecCompliantSctpOffer(cricket::SessionDescription* desc) { |
| 2486 const ContentInfo* dc_offer = GetFirstDataContent(desc); |
| 2487 ASSERT_NE(nullptr, dc_offer); |
| 2488 cricket::DataContentDescription* dcd_offer = |
| 2489 static_cast<cricket::DataContentDescription*>(dc_offer->description); |
| 2490 dcd_offer->set_use_sctpmap(false); |
| 2491 dcd_offer->set_protocol("UDP/DTLS/SCTP"); |
| 2492 } |
| 2493 |
| 2494 // Test that the data channel works when a spec-compliant SCTP m= section is |
| 2495 // offered (using "a=sctp-port" instead of "a=sctpmap", and using |
| 2496 // "UDP/DTLS/SCTP" as the protocol). |
| 2497 TEST_F(PeerConnectionIntegrationTest, |
| 2498 DataChannelWorksWhenSpecCompliantSctpOfferReceived) { |
| 2499 ASSERT_TRUE(CreatePeerConnectionWrappers()); |
| 2500 ConnectFakeSignaling(); |
| 2501 caller()->CreateDataChannel(); |
| 2502 caller()->SetGeneratedSdpMunger(MakeSpecCompliantSctpOffer); |
| 2503 caller()->CreateAndSetAndSignalOffer(); |
| 2504 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
| 2505 ASSERT_TRUE_WAIT(callee()->data_channel() != nullptr, kDefaultTimeout); |
| 2506 EXPECT_TRUE_WAIT(caller()->data_observer()->IsOpen(), kDefaultTimeout); |
| 2507 EXPECT_TRUE_WAIT(callee()->data_observer()->IsOpen(), kDefaultTimeout); |
| 2508 |
| 2509 // Ensure data can be sent in both directions. |
| 2510 std::string data = "hello world"; |
| 2511 caller()->data_channel()->Send(DataBuffer(data)); |
| 2512 EXPECT_EQ_WAIT(data, callee()->data_observer()->last_message(), |
| 2513 kDefaultTimeout); |
| 2514 callee()->data_channel()->Send(DataBuffer(data)); |
| 2515 EXPECT_EQ_WAIT(data, caller()->data_observer()->last_message(), |
| 2516 kDefaultTimeout); |
| 2517 } |
| 2518 |
2485 #endif // HAVE_SCTP | 2519 #endif // HAVE_SCTP |
2486 | 2520 |
2487 // Test that the ICE connection and gathering states eventually reach | 2521 // Test that the ICE connection and gathering states eventually reach |
2488 // "complete". | 2522 // "complete". |
2489 TEST_F(PeerConnectionIntegrationTest, IceStatesReachCompletion) { | 2523 TEST_F(PeerConnectionIntegrationTest, IceStatesReachCompletion) { |
2490 ASSERT_TRUE(CreatePeerConnectionWrappers()); | 2524 ASSERT_TRUE(CreatePeerConnectionWrappers()); |
2491 ConnectFakeSignaling(); | 2525 ConnectFakeSignaling(); |
2492 // Do normal offer/answer. | 2526 // Do normal offer/answer. |
2493 caller()->AddAudioVideoMediaStream(); | 2527 caller()->AddAudioVideoMediaStream(); |
2494 callee()->AddAudioVideoMediaStream(); | 2528 callee()->AddAudioVideoMediaStream(); |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2936 caller()->CreateAndSetAndSignalOffer(); | 2970 caller()->CreateAndSetAndSignalOffer(); |
2937 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); | 2971 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); |
2938 // Wait for additional audio frames to be received by the callee. | 2972 // Wait for additional audio frames to be received by the callee. |
2939 ExpectNewFramesReceivedWithWait(0, 0, kDefaultExpectedAudioFrameCount, 0, | 2973 ExpectNewFramesReceivedWithWait(0, 0, kDefaultExpectedAudioFrameCount, 0, |
2940 kMaxWaitForFramesMs); | 2974 kMaxWaitForFramesMs); |
2941 } | 2975 } |
2942 | 2976 |
2943 } // namespace | 2977 } // namespace |
2944 | 2978 |
2945 #endif // if !defined(THREAD_SANITIZER) | 2979 #endif // if !defined(THREAD_SANITIZER) |
OLD | NEW |