OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2009 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 3559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3570 'f', 'o', 'o' | 3570 'f', 'o', 'o' |
3571 }; | 3571 }; |
3572 rtc::CopyOnWriteBuffer payload(data, 3); | 3572 rtc::CopyOnWriteBuffer payload(data, 3); |
3573 cricket::SendDataResult result; | 3573 cricket::SendDataResult result; |
3574 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 3574 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
3575 EXPECT_EQ(params.ssrc, | 3575 EXPECT_EQ(params.ssrc, |
3576 media_channel1_->last_sent_data_params().ssrc); | 3576 media_channel1_->last_sent_data_params().ssrc); |
3577 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 3577 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
3578 } | 3578 } |
3579 | 3579 |
| 3580 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
| 3581 |
| 3582 // Verifies some DCHECKs are in place. |
| 3583 // Uses VoiceChannel, but any BaseChannel subclass would work. |
| 3584 class BaseChannelDeathTest : public testing::Test { |
| 3585 public: |
| 3586 BaseChannelDeathTest() |
| 3587 : // RTCP mux not required, SRTP required. |
| 3588 voice_channel_( |
| 3589 rtc::Thread::Current(), |
| 3590 rtc::Thread::Current(), |
| 3591 rtc::Thread::Current(), |
| 3592 &fake_media_engine_, |
| 3593 new cricket::FakeVoiceMediaChannel(nullptr, |
| 3594 cricket::AudioOptions()), |
| 3595 cricket::CN_AUDIO, |
| 3596 false, |
| 3597 true) { |
| 3598 rtp_transport_ = fake_transport_controller_.CreateTransportChannel( |
| 3599 "foo", cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 3600 rtcp_transport_ = fake_transport_controller_.CreateTransportChannel( |
| 3601 "foo", cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 3602 EXPECT_TRUE(voice_channel_.Init_w(rtp_transport_, rtcp_transport_)); |
| 3603 } |
| 3604 |
| 3605 protected: |
| 3606 cricket::FakeTransportController fake_transport_controller_; |
| 3607 cricket::FakeMediaEngine fake_media_engine_; |
| 3608 cricket::VoiceChannel voice_channel_; |
| 3609 // Will be cleaned up by FakeTransportController, don't need to worry about |
| 3610 // deleting them in this test. |
| 3611 cricket::TransportChannel* rtp_transport_; |
| 3612 cricket::TransportChannel* rtcp_transport_; |
| 3613 }; |
| 3614 |
| 3615 TEST_F(BaseChannelDeathTest, SetTransportWithNullRtpTransport) { |
| 3616 cricket::TransportChannel* new_rtcp_transport = |
| 3617 fake_transport_controller_.CreateTransportChannel( |
| 3618 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 3619 EXPECT_DEATH(voice_channel_.SetTransports(nullptr, new_rtcp_transport), ""); |
| 3620 } |
| 3621 |
| 3622 TEST_F(BaseChannelDeathTest, SetTransportWithMissingRtcpTransport) { |
| 3623 cricket::TransportChannel* new_rtp_transport = |
| 3624 fake_transport_controller_.CreateTransportChannel( |
| 3625 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 3626 EXPECT_DEATH(voice_channel_.SetTransports(new_rtp_transport, nullptr), ""); |
| 3627 } |
| 3628 |
| 3629 TEST_F(BaseChannelDeathTest, SetTransportWithUnneededRtcpTransport) { |
| 3630 // Activate RTCP muxing, simulating offer/answer negotiation. |
| 3631 cricket::AudioContentDescription content; |
| 3632 content.set_rtcp_mux(true); |
| 3633 ASSERT_TRUE(voice_channel_.SetLocalContent(&content, CA_OFFER, nullptr)); |
| 3634 ASSERT_TRUE(voice_channel_.SetRemoteContent(&content, CA_ANSWER, nullptr)); |
| 3635 cricket::TransportChannel* new_rtp_transport = |
| 3636 fake_transport_controller_.CreateTransportChannel( |
| 3637 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 3638 cricket::TransportChannel* new_rtcp_transport = |
| 3639 fake_transport_controller_.CreateTransportChannel( |
| 3640 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 3641 // After muxing is enabled, no RTCP transport should be passed in here. |
| 3642 EXPECT_DEATH( |
| 3643 voice_channel_.SetTransports(new_rtp_transport, new_rtcp_transport), ""); |
| 3644 } |
| 3645 |
| 3646 // This test will probably go away if/when we move the transport name out of |
| 3647 // the transport classes and into their parent classes. |
| 3648 TEST_F(BaseChannelDeathTest, SetTransportWithMismatchingTransportNames) { |
| 3649 cricket::TransportChannel* new_rtp_transport = |
| 3650 fake_transport_controller_.CreateTransportChannel( |
| 3651 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 3652 cricket::TransportChannel* new_rtcp_transport = |
| 3653 fake_transport_controller_.CreateTransportChannel( |
| 3654 "baz", cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 3655 EXPECT_DEATH( |
| 3656 voice_channel_.SetTransports(new_rtp_transport, new_rtcp_transport), ""); |
| 3657 } |
| 3658 |
| 3659 #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
| 3660 |
3580 // TODO(pthatcher): TestSetReceiver? | 3661 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |