1 /*
2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include "webrtc/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h"
12 
13 using namespace webrtc;
14 using namespace testing;
15 
16 class RtpRtcpBeforeStreamingTest : public AfterInitializationFixture {
17  protected:
18   void SetUp();
19   void TearDown();
20 
21   int channel_;
22 };
23 
SetUp()24 void RtpRtcpBeforeStreamingTest::SetUp() {
25   EXPECT_THAT(channel_ = voe_base_->CreateChannel(), Not(Lt(0)));
26 }
27 
TearDown()28 void RtpRtcpBeforeStreamingTest::TearDown() {
29   EXPECT_EQ(0, voe_base_->DeleteChannel(channel_));
30 }
31 
TEST_F(RtpRtcpBeforeStreamingTest,GetRtcpStatusReturnsTrueByDefaultAndObeysSetRtcpStatus)32 TEST_F(RtpRtcpBeforeStreamingTest,
33        GetRtcpStatusReturnsTrueByDefaultAndObeysSetRtcpStatus) {
34   bool on = false;
35   EXPECT_EQ(0, voe_rtp_rtcp_->GetRTCPStatus(channel_, on));
36   EXPECT_TRUE(on);
37   EXPECT_EQ(0, voe_rtp_rtcp_->SetRTCPStatus(channel_, false));
38   EXPECT_EQ(0, voe_rtp_rtcp_->GetRTCPStatus(channel_, on));
39   EXPECT_FALSE(on);
40   EXPECT_EQ(0, voe_rtp_rtcp_->SetRTCPStatus(channel_, true));
41   EXPECT_EQ(0, voe_rtp_rtcp_->GetRTCPStatus(channel_, on));
42   EXPECT_TRUE(on);
43 }
44 
TEST_F(RtpRtcpBeforeStreamingTest,GetLocalSsrcObeysSetLocalSsrc)45 TEST_F(RtpRtcpBeforeStreamingTest, GetLocalSsrcObeysSetLocalSsrc) {
46   EXPECT_EQ(0, voe_rtp_rtcp_->SetLocalSSRC(channel_, 1234));
47   unsigned int result = 0;
48   EXPECT_EQ(0, voe_rtp_rtcp_->GetLocalSSRC(channel_, result));
49   EXPECT_EQ(1234u, result);
50 }
51