
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}
60 lines
2.1 KiB
C++
60 lines
2.1 KiB
C++
/*
|
|
* 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
|