Remove cricket::RtpTransceiverDirection

Replaces cricket::RtpTransceiverDirection with
webrtc::RtpTransceiverDirection, which is part of the public API.

Bug: webrtc:8558
Change-Id: Ibfc9373e25187e98fb969e7ac937a1371c8fa4c7
Reviewed-on: https://webrtc-review.googlesource.com/24129
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Peter Thatcher <pthatcher@webrtc.org>
Reviewed-by: Zhi Huang <zhihuang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20899}
This commit is contained in:
Steve Anton
2017-11-27 14:30:09 -08:00
committed by Commit Bot
parent 9158ef6575
commit 1d03a751b0
11 changed files with 316 additions and 134 deletions

View File

@ -0,0 +1,59 @@
/*
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "pc/rtpmediautils.h"
#include "test/gtest.h"
namespace webrtc {
using ::testing::Values;
class EnumerateAllDirectionsTest
: public ::testing::Test,
public ::testing::WithParamInterface<RtpTransceiverDirection> {};
// Test that converting the direction to send/recv and back again results in the
// same direction.
TEST_P(EnumerateAllDirectionsTest, TestIdentity) {
RtpTransceiverDirection direction = GetParam();
bool send = RtpTransceiverDirectionHasSend(direction);
bool recv = RtpTransceiverDirectionHasRecv(direction);
EXPECT_EQ(direction, RtpTransceiverDirectionFromSendRecv(send, recv));
}
// Test that reversing the direction is equivalent to swapping send/recv.
TEST_P(EnumerateAllDirectionsTest, TestReversedSwapped) {
RtpTransceiverDirection direction = GetParam();
bool send = RtpTransceiverDirectionHasSend(direction);
bool recv = RtpTransceiverDirectionHasRecv(direction);
EXPECT_EQ(RtpTransceiverDirectionFromSendRecv(recv, send),
RtpTransceiverDirectionReversed(direction));
}
// Test that reversing the direction twice results in the same direction.
TEST_P(EnumerateAllDirectionsTest, TestReversedIdentity) {
RtpTransceiverDirection direction = GetParam();
EXPECT_EQ(direction, RtpTransceiverDirectionReversed(
RtpTransceiverDirectionReversed(direction)));
}
INSTANTIATE_TEST_CASE_P(RtpTransceiverDirectionTest,
EnumerateAllDirectionsTest,
Values(RtpTransceiverDirection::kSendRecv,
RtpTransceiverDirection::kSendOnly,
RtpTransceiverDirection::kRecvOnly,
RtpTransceiverDirection::kInactive));
} // namespace webrtc