Replace use of ASSERT in test code.
In top level test functions, replaced with gtest ASSERT_*. In helper
methods in main test files, replaced with EXPECT_* or RTC_DCHECK on a
case-by-case basis.
In separate mock/fake classes used by tests (which might be of some
use also in tests of third-party applications), ASSERT was replaced
with RTC_CHECK, using
git grep -l ' ASSERT(' | grep -v common.h | \
xargs sed -i 's/ ASSERT(/ RTC_CHECK(/'
followed by additional includes of base/checks.h in affected files,
and git cl format.
BUG=webrtc:6424
Review-Url: https://codereview.webrtc.org/2622413005
Cr-Commit-Position: refs/heads/master@{#16150}
This commit is contained in:
parent
f20dd0014d
commit
c8ee882753
@ -790,22 +790,22 @@ TEST_F(RTCStatsCollectorTest, CollectRTCCodecStats) {
|
||||
expected_outbound_video_codec.codec = "video/VP8";
|
||||
expected_outbound_video_codec.clock_rate = 1340;
|
||||
|
||||
ASSERT(report->Get(expected_inbound_audio_codec.id()));
|
||||
ASSERT_TRUE(report->Get(expected_inbound_audio_codec.id()));
|
||||
EXPECT_EQ(expected_inbound_audio_codec,
|
||||
report->Get(expected_inbound_audio_codec.id())->cast_to<
|
||||
RTCCodecStats>());
|
||||
|
||||
ASSERT(report->Get(expected_outbound_audio_codec.id()));
|
||||
ASSERT_TRUE(report->Get(expected_outbound_audio_codec.id()));
|
||||
EXPECT_EQ(expected_outbound_audio_codec,
|
||||
report->Get(expected_outbound_audio_codec.id())->cast_to<
|
||||
RTCCodecStats>());
|
||||
|
||||
ASSERT(report->Get(expected_inbound_video_codec.id()));
|
||||
ASSERT_TRUE(report->Get(expected_inbound_video_codec.id()));
|
||||
EXPECT_EQ(expected_inbound_video_codec,
|
||||
report->Get(expected_inbound_video_codec.id())->cast_to<
|
||||
RTCCodecStats>());
|
||||
|
||||
ASSERT(report->Get(expected_outbound_video_codec.id()));
|
||||
ASSERT_TRUE(report->Get(expected_outbound_video_codec.id()));
|
||||
EXPECT_EQ(expected_outbound_video_codec,
|
||||
report->Get(expected_outbound_video_codec.id())->cast_to<
|
||||
RTCCodecStats>());
|
||||
@ -1618,7 +1618,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) {
|
||||
expected_audio.jitter = 4.5;
|
||||
expected_audio.fraction_lost = 5.5;
|
||||
|
||||
ASSERT(report->Get(expected_audio.id()));
|
||||
ASSERT_TRUE(report->Get(expected_audio.id()));
|
||||
const RTCInboundRTPStreamStats& audio = report->Get(
|
||||
expected_audio.id())->cast_to<RTCInboundRTPStreamStats>();
|
||||
EXPECT_EQ(audio, expected_audio);
|
||||
@ -1703,7 +1703,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) {
|
||||
expected_video.fraction_lost = 4.5;
|
||||
expected_video.frames_decoded = 8;
|
||||
|
||||
ASSERT(report->Get(expected_video.id()));
|
||||
ASSERT_TRUE(report->Get(expected_video.id()));
|
||||
const RTCInboundRTPStreamStats& video = report->Get(
|
||||
expected_video.id())->cast_to<RTCInboundRTPStreamStats>();
|
||||
EXPECT_EQ(video, expected_video);
|
||||
@ -1776,7 +1776,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Audio) {
|
||||
expected_audio.bytes_sent = 3;
|
||||
expected_audio.round_trip_time = 4.5;
|
||||
|
||||
ASSERT(report->Get(expected_audio.id()));
|
||||
ASSERT_TRUE(report->Get(expected_audio.id()));
|
||||
const RTCOutboundRTPStreamStats& audio = report->Get(
|
||||
expected_audio.id())->cast_to<RTCOutboundRTPStreamStats>();
|
||||
EXPECT_EQ(audio, expected_audio);
|
||||
@ -1859,7 +1859,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Video) {
|
||||
expected_video.frames_encoded = 8;
|
||||
expected_video.qp_sum = 16;
|
||||
|
||||
ASSERT(report->Get(expected_video.id()));
|
||||
ASSERT_TRUE(report->Get(expected_video.id()));
|
||||
const RTCOutboundRTPStreamStats& video = report->Get(
|
||||
expected_video.id())->cast_to<RTCOutboundRTPStreamStats>();
|
||||
EXPECT_EQ(video, expected_video);
|
||||
@ -1943,7 +1943,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Default) {
|
||||
expected_audio.bytes_sent = 3;
|
||||
// |expected_audio.round_trip_time| should be undefined.
|
||||
|
||||
ASSERT(report->Get(expected_audio.id()));
|
||||
ASSERT_TRUE(report->Get(expected_audio.id()));
|
||||
const RTCOutboundRTPStreamStats& audio = report->Get(
|
||||
expected_audio.id())->cast_to<RTCOutboundRTPStreamStats>();
|
||||
EXPECT_EQ(audio, expected_audio);
|
||||
@ -1965,7 +1965,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Default) {
|
||||
// |expected_video.round_trip_time| should be undefined.
|
||||
// |expected_video.qp_sum| should be undefined.
|
||||
|
||||
ASSERT(report->Get(expected_video.id()));
|
||||
ASSERT_TRUE(report->Get(expected_video.id()));
|
||||
const RTCOutboundRTPStreamStats& video = report->Get(
|
||||
expected_video.id())->cast_to<RTCOutboundRTPStreamStats>();
|
||||
EXPECT_EQ(video, expected_video);
|
||||
|
||||
@ -618,7 +618,7 @@ class StatsCollectorTest : public testing::Test {
|
||||
StatsReports* reports) {
|
||||
// A track can't have both sender report and recv report at the same time
|
||||
// for now, this might change in the future though.
|
||||
ASSERT((voice_sender_info == NULL) ^ (voice_receiver_info == NULL));
|
||||
EXPECT_TRUE((voice_sender_info == NULL) ^ (voice_receiver_info == NULL));
|
||||
|
||||
// Instruct the session to return stats containing the transport channel.
|
||||
InitSessionStats(vc_name);
|
||||
@ -1315,7 +1315,7 @@ TEST_F(StatsCollectorTest, IceCandidateReport) {
|
||||
uint32_t priority = 1000;
|
||||
|
||||
cricket::Candidate c;
|
||||
ASSERT(c.id().length() > 0);
|
||||
EXPECT_GT(c.id().length(), 0u);
|
||||
c.set_type(cricket::LOCAL_PORT_TYPE);
|
||||
c.set_protocol(cricket::UDP_PROTOCOL_NAME);
|
||||
c.set_address(local_address);
|
||||
@ -1325,7 +1325,7 @@ TEST_F(StatsCollectorTest, IceCandidateReport) {
|
||||
EXPECT_EQ("Cand-" + c.id(), report_id);
|
||||
|
||||
c = cricket::Candidate();
|
||||
ASSERT(c.id().length() > 0);
|
||||
EXPECT_GT(c.id().length(), 0u);
|
||||
c.set_type(cricket::PRFLX_PORT_TYPE);
|
||||
c.set_protocol(cricket::UDP_PROTOCOL_NAME);
|
||||
c.set_address(remote_address);
|
||||
|
||||
@ -639,7 +639,7 @@ void FakeAudioCaptureModule::UpdateProcessing(bool start) {
|
||||
}
|
||||
|
||||
void FakeAudioCaptureModule::StartProcessP() {
|
||||
ASSERT(process_thread_->IsCurrent());
|
||||
RTC_CHECK(process_thread_->IsCurrent());
|
||||
if (started_) {
|
||||
// Already started.
|
||||
return;
|
||||
@ -648,7 +648,7 @@ void FakeAudioCaptureModule::StartProcessP() {
|
||||
}
|
||||
|
||||
void FakeAudioCaptureModule::ProcessFrameP() {
|
||||
ASSERT(process_thread_->IsCurrent());
|
||||
RTC_CHECK(process_thread_->IsCurrent());
|
||||
if (!started_) {
|
||||
next_frame_time_ = rtc::TimeMillis();
|
||||
started_ = true;
|
||||
@ -673,7 +673,7 @@ void FakeAudioCaptureModule::ProcessFrameP() {
|
||||
}
|
||||
|
||||
void FakeAudioCaptureModule::ReceiveFrameP() {
|
||||
ASSERT(process_thread_->IsCurrent());
|
||||
RTC_CHECK(process_thread_->IsCurrent());
|
||||
{
|
||||
rtc::CritScope cs(&crit_callback_);
|
||||
if (!audio_callback_) {
|
||||
@ -689,7 +689,7 @@ void FakeAudioCaptureModule::ReceiveFrameP() {
|
||||
&elapsed_time_ms, &ntp_time_ms) != 0) {
|
||||
RTC_NOTREACHED();
|
||||
}
|
||||
ASSERT(nSamplesOut == kNumberSamples);
|
||||
RTC_CHECK(nSamplesOut == kNumberSamples);
|
||||
}
|
||||
// The SetBuffer() function ensures that after decoding, the audio buffer
|
||||
// should contain samples of similar magnitude (there is likely to be some
|
||||
@ -704,7 +704,7 @@ void FakeAudioCaptureModule::ReceiveFrameP() {
|
||||
}
|
||||
|
||||
void FakeAudioCaptureModule::SendFrameP() {
|
||||
ASSERT(process_thread_->IsCurrent());
|
||||
RTC_CHECK(process_thread_->IsCurrent());
|
||||
rtc::CritScope cs(&crit_callback_);
|
||||
if (!audio_callback_) {
|
||||
return;
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#define WEBRTC_API_TEST_FAKEDATACHANNELPROVIDER_H_
|
||||
|
||||
#include "webrtc/api/datachannel.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
|
||||
class FakeDataChannelProvider : public webrtc::DataChannelProviderInterface {
|
||||
public:
|
||||
@ -25,7 +26,7 @@ class FakeDataChannelProvider : public webrtc::DataChannelProviderInterface {
|
||||
bool SendData(const cricket::SendDataParams& params,
|
||||
const rtc::CopyOnWriteBuffer& payload,
|
||||
cricket::SendDataResult* result) override {
|
||||
ASSERT(ready_to_send_ && transport_available_);
|
||||
RTC_CHECK(ready_to_send_ && transport_available_);
|
||||
if (send_blocked_) {
|
||||
*result = cricket::SDR_BLOCK;
|
||||
return false;
|
||||
@ -41,7 +42,8 @@ class FakeDataChannelProvider : public webrtc::DataChannelProviderInterface {
|
||||
}
|
||||
|
||||
bool ConnectDataChannel(webrtc::DataChannel* data_channel) override {
|
||||
ASSERT(connected_channels_.find(data_channel) == connected_channels_.end());
|
||||
RTC_CHECK(connected_channels_.find(data_channel) ==
|
||||
connected_channels_.end());
|
||||
if (!transport_available_) {
|
||||
return false;
|
||||
}
|
||||
@ -51,13 +53,14 @@ class FakeDataChannelProvider : public webrtc::DataChannelProviderInterface {
|
||||
}
|
||||
|
||||
void DisconnectDataChannel(webrtc::DataChannel* data_channel) override {
|
||||
ASSERT(connected_channels_.find(data_channel) != connected_channels_.end());
|
||||
RTC_CHECK(connected_channels_.find(data_channel) !=
|
||||
connected_channels_.end());
|
||||
LOG(LS_INFO) << "DataChannel disconnected " << data_channel;
|
||||
connected_channels_.erase(data_channel);
|
||||
}
|
||||
|
||||
void AddSctpDataStream(int sid) override {
|
||||
ASSERT(sid >= 0);
|
||||
RTC_CHECK(sid >= 0);
|
||||
if (!transport_available_) {
|
||||
return;
|
||||
}
|
||||
@ -66,7 +69,7 @@ class FakeDataChannelProvider : public webrtc::DataChannelProviderInterface {
|
||||
}
|
||||
|
||||
void RemoveSctpDataStream(int sid) override {
|
||||
ASSERT(sid >= 0);
|
||||
RTC_CHECK(sid >= 0);
|
||||
send_ssrcs_.erase(sid);
|
||||
recv_ssrcs_.erase(sid);
|
||||
}
|
||||
@ -99,7 +102,7 @@ class FakeDataChannelProvider : public webrtc::DataChannelProviderInterface {
|
||||
// Set true to emulate the transport ReadyToSendData signal when the transport
|
||||
// becomes writable for the first time.
|
||||
void set_ready_to_send(bool ready) {
|
||||
ASSERT(transport_available_);
|
||||
RTC_CHECK(transport_available_);
|
||||
ready_to_send_ = ready;
|
||||
if (ready) {
|
||||
std::set<webrtc::DataChannel*>::iterator it;
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/api/datachannelinterface.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -109,7 +110,7 @@ class MockStatsObserver : public webrtc::StatsObserver {
|
||||
virtual ~MockStatsObserver() {}
|
||||
|
||||
virtual void OnComplete(const StatsReports& reports) {
|
||||
ASSERT(!called_);
|
||||
RTC_CHECK(!called_);
|
||||
called_ = true;
|
||||
stats_.Clear();
|
||||
stats_.number_of_reports = reports.size();
|
||||
@ -143,37 +144,37 @@ class MockStatsObserver : public webrtc::StatsObserver {
|
||||
double timestamp() const { return stats_.timestamp; }
|
||||
|
||||
int AudioOutputLevel() const {
|
||||
ASSERT(called_);
|
||||
RTC_CHECK(called_);
|
||||
return stats_.audio_output_level;
|
||||
}
|
||||
|
||||
int AudioInputLevel() const {
|
||||
ASSERT(called_);
|
||||
RTC_CHECK(called_);
|
||||
return stats_.audio_input_level;
|
||||
}
|
||||
|
||||
int BytesReceived() const {
|
||||
ASSERT(called_);
|
||||
RTC_CHECK(called_);
|
||||
return stats_.bytes_received;
|
||||
}
|
||||
|
||||
int BytesSent() const {
|
||||
ASSERT(called_);
|
||||
RTC_CHECK(called_);
|
||||
return stats_.bytes_sent;
|
||||
}
|
||||
|
||||
int AvailableReceiveBandwidth() const {
|
||||
ASSERT(called_);
|
||||
RTC_CHECK(called_);
|
||||
return stats_.available_receive_bandwidth;
|
||||
}
|
||||
|
||||
std::string DtlsCipher() const {
|
||||
ASSERT(called_);
|
||||
RTC_CHECK(called_);
|
||||
return stats_.dtls_cipher;
|
||||
}
|
||||
|
||||
std::string SrtpCipher() const {
|
||||
ASSERT(called_);
|
||||
RTC_CHECK(called_);
|
||||
return stats_.srtp_cipher;
|
||||
}
|
||||
|
||||
|
||||
@ -1450,10 +1450,10 @@ class WebRtcSessionTest
|
||||
|
||||
bool VerifyNoCNCodecs(const cricket::ContentInfo* content) {
|
||||
const cricket::ContentDescription* description = content->description;
|
||||
ASSERT(description != NULL);
|
||||
RTC_CHECK(description != NULL);
|
||||
const cricket::AudioContentDescription* audio_content_desc =
|
||||
static_cast<const cricket::AudioContentDescription*>(description);
|
||||
ASSERT(audio_content_desc != NULL);
|
||||
RTC_CHECK(audio_content_desc != NULL);
|
||||
for (size_t i = 0; i < audio_content_desc->codecs().size(); ++i) {
|
||||
if (audio_content_desc->codecs()[i].name == "CN")
|
||||
return false;
|
||||
@ -1463,7 +1463,7 @@ class WebRtcSessionTest
|
||||
|
||||
void CreateDataChannel() {
|
||||
webrtc::InternalDataChannelInit dci;
|
||||
ASSERT(session_.get());
|
||||
RTC_CHECK(session_.get());
|
||||
dci.reliable = session_->data_channel_type() == cricket::DCT_SCTP;
|
||||
data_channel_ = DataChannel::Create(
|
||||
session_.get(), session_->data_channel_type(), "datachannel", dci);
|
||||
@ -3082,7 +3082,7 @@ TEST_F(WebRtcSessionTest, TestIgnoreCandidatesForUnusedTransportWhenBundling) {
|
||||
session_->video_rtp_transport_channel());
|
||||
|
||||
cricket::BaseChannel* voice_channel = session_->voice_channel();
|
||||
ASSERT(voice_channel != NULL);
|
||||
ASSERT_TRUE(voice_channel != NULL);
|
||||
|
||||
// Checks if one of the transport channels contains a connection using a given
|
||||
// port.
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#include "webrtc/base/network.h"
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/nethelpers.h"
|
||||
#include "webrtc/base/networkmonitor.h"
|
||||
#include <memory>
|
||||
@ -103,7 +104,7 @@ class NetworkTest : public testing::Test, public sigslot::has_slots<> {
|
||||
AdapterType GetAdapterType(BasicNetworkManager& network_manager) {
|
||||
BasicNetworkManager::NetworkList list;
|
||||
network_manager.GetNetworks(&list);
|
||||
ASSERT(list.size() == 1u);
|
||||
RTC_CHECK(list.size() == 1u);
|
||||
return list[0]->type();
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/fileutils.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/optionsfile.h"
|
||||
@ -46,7 +47,7 @@ class MAYBE_OptionsFileTest : public testing::Test {
|
||||
public:
|
||||
MAYBE_OptionsFileTest() {
|
||||
Pathname dir;
|
||||
ASSERT(Filesystem::GetTemporaryFolder(dir, true, NULL));
|
||||
RTC_CHECK(Filesystem::GetTemporaryFolder(dir, true, NULL));
|
||||
test_file_ = Filesystem::TempFilename(dir, ".testfile");
|
||||
OpenStore();
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/common.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/event.h"
|
||||
@ -60,9 +61,9 @@ class ReadTask : public SharedExclusiveTask {
|
||||
|
||||
private:
|
||||
virtual void OnMessage(Message* message) {
|
||||
ASSERT(rtc::Thread::Current() == worker_thread_.get());
|
||||
ASSERT(message != NULL);
|
||||
ASSERT(message->message_id == kMsgRead);
|
||||
RTC_CHECK(rtc::Thread::Current() == worker_thread_.get());
|
||||
RTC_CHECK(message != NULL);
|
||||
RTC_CHECK(message->message_id == kMsgRead);
|
||||
|
||||
TypedMessageData<int*>* message_data =
|
||||
static_cast<TypedMessageData<int*>*>(message->pdata);
|
||||
@ -90,9 +91,9 @@ class WriteTask : public SharedExclusiveTask {
|
||||
|
||||
private:
|
||||
virtual void OnMessage(Message* message) {
|
||||
ASSERT(rtc::Thread::Current() == worker_thread_.get());
|
||||
ASSERT(message != NULL);
|
||||
ASSERT(message->message_id == kMsgWrite);
|
||||
RTC_CHECK(rtc::Thread::Current() == worker_thread_.get());
|
||||
RTC_CHECK(message != NULL);
|
||||
RTC_CHECK(message->message_id == kMsgWrite);
|
||||
|
||||
TypedMessageData<int>* message_data =
|
||||
static_cast<TypedMessageData<int>*>(message->pdata);
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/base/bufferqueue.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/helpers.h"
|
||||
#include "webrtc/base/ssladapter.h"
|
||||
@ -383,7 +384,7 @@ class SSLStreamAdapterTestBase : public testing::Test,
|
||||
// Make sure we simulate a reliable network for TLS.
|
||||
// This is just a check to make sure that people don't write wrong
|
||||
// tests.
|
||||
ASSERT((mtu_ == 1460) && (loss_ == 0) && (lose_first_packet_ == 0));
|
||||
RTC_CHECK((mtu_ == 1460) && (loss_ == 0) && (lose_first_packet_ == 0));
|
||||
}
|
||||
|
||||
if (!identities_set_)
|
||||
@ -420,7 +421,7 @@ class SSLStreamAdapterTestBase : public testing::Test,
|
||||
// Make sure we simulate a reliable network for TLS.
|
||||
// This is just a check to make sure that people don't write wrong
|
||||
// tests.
|
||||
ASSERT((mtu_ == 1460) && (loss_ == 0) && (lose_first_packet_ == 0));
|
||||
RTC_CHECK((mtu_ == 1460) && (loss_ == 0) && (lose_first_packet_ == 0));
|
||||
}
|
||||
|
||||
// Start the handshake
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#include <vector>
|
||||
#include "webrtc/base/arraysize.h"
|
||||
#include "webrtc/base/asyncsocket.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/common.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/nethelpers.h"
|
||||
@ -177,7 +178,7 @@ public:
|
||||
va_start(args, format);
|
||||
char buffer[1024];
|
||||
size_t len = vsprintfn(buffer, sizeof(buffer), format, args);
|
||||
ASSERT(len < sizeof(buffer) - 1);
|
||||
RTC_CHECK(len < sizeof(buffer) - 1);
|
||||
va_end(args);
|
||||
QueueData(buffer, len);
|
||||
}
|
||||
@ -297,7 +298,7 @@ public:
|
||||
va_start(args, format);
|
||||
char buffer[1024];
|
||||
size_t len = vsprintfn(buffer, sizeof(buffer), format, args);
|
||||
ASSERT(len < sizeof(buffer) - 1);
|
||||
RTC_CHECK(len < sizeof(buffer) - 1);
|
||||
va_end(args);
|
||||
QueueData(buffer, len);
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include "webrtc/p2p/base/dtlstransportchannel.h"
|
||||
#include "webrtc/p2p/base/faketransportcontroller.h"
|
||||
#include "webrtc/p2p/base/packettransportinterface.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/common.h"
|
||||
#include "webrtc/base/dscp.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
@ -78,7 +79,7 @@ class DtlsTestClient : public sigslot::has_slots<> {
|
||||
return certificate_;
|
||||
}
|
||||
void SetupSrtp() {
|
||||
ASSERT(certificate_);
|
||||
EXPECT_TRUE(certificate_ != nullptr);
|
||||
use_dtls_srtp_ = true;
|
||||
}
|
||||
void SetupMaxProtocolVersion(rtc::SSLProtocolVersion version) {
|
||||
@ -300,7 +301,7 @@ class DtlsTestClient : public sigslot::has_slots<> {
|
||||
}
|
||||
|
||||
void SendPackets(size_t channel, size_t size, size_t count, bool srtp) {
|
||||
ASSERT(channel < channels_.size());
|
||||
RTC_CHECK(channel < channels_.size());
|
||||
std::unique_ptr<char[]> packet(new char[size]);
|
||||
size_t sent = 0;
|
||||
do {
|
||||
@ -324,7 +325,7 @@ class DtlsTestClient : public sigslot::has_slots<> {
|
||||
}
|
||||
|
||||
int SendInvalidSrtpPacket(size_t channel, size_t size) {
|
||||
ASSERT(channel < channels_.size());
|
||||
RTC_CHECK(channel < channels_.size());
|
||||
std::unique_ptr<char[]> packet(new char[size]);
|
||||
// Fill the packet with 0 to form an invalid SRTP packet.
|
||||
memset(packet.get(), 0, size);
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#include "webrtc/p2p/base/teststunserver.h"
|
||||
#include "webrtc/p2p/base/testturnserver.h"
|
||||
#include "webrtc/p2p/client/basicportallocator.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/dscp.h"
|
||||
#include "webrtc/base/fakeclock.h"
|
||||
#include "webrtc/base/fakenetwork.h"
|
||||
@ -2056,7 +2057,7 @@ TEST_F(P2PTransportChannelTest, SignalReadyToSendWithPresumedWritable) {
|
||||
class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase {
|
||||
protected:
|
||||
void ConfigureEndpoints(Config nat_type, Config config1, Config config2) {
|
||||
ASSERT(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC);
|
||||
RTC_CHECK(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC);
|
||||
rtc::NATSocketServer::Translator* outer_nat =
|
||||
nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0],
|
||||
static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE));
|
||||
@ -2066,7 +2067,7 @@ class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase {
|
||||
}
|
||||
void ConfigureEndpoint(rtc::NATSocketServer::Translator* nat,
|
||||
int endpoint, Config config) {
|
||||
ASSERT(config <= NAT_SYMMETRIC);
|
||||
RTC_CHECK(config <= NAT_SYMMETRIC);
|
||||
if (config == OPEN) {
|
||||
AddAddress(endpoint, kPrivateAddrs[endpoint]);
|
||||
nat->AddClient(kPrivateAddrs[endpoint]);
|
||||
|
||||
@ -1300,7 +1300,7 @@ TEST_F(PortTest, TestConnectionDead) {
|
||||
ch1.CreateConnection(GetCandidate(port2));
|
||||
int64_t after_created = rtc::TimeMillis();
|
||||
Connection* conn = ch1.conn();
|
||||
ASSERT(conn != nullptr);
|
||||
ASSERT_NE(conn, nullptr);
|
||||
// It is not dead if it is after MIN_CONNECTION_LIFETIME but not pruned.
|
||||
conn->UpdateState(after_created + MIN_CONNECTION_LIFETIME + 1);
|
||||
rtc::Thread::Current()->ProcessMessages(0);
|
||||
@ -1318,7 +1318,7 @@ TEST_F(PortTest, TestConnectionDead) {
|
||||
// Create a connection again and receive a ping.
|
||||
ch1.CreateConnection(GetCandidate(port2));
|
||||
conn = ch1.conn();
|
||||
ASSERT(conn != nullptr);
|
||||
ASSERT_NE(conn, nullptr);
|
||||
int64_t before_last_receiving = rtc::TimeMillis();
|
||||
conn->ReceivedPing();
|
||||
int64_t after_last_receiving = rtc::TimeMillis();
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include "webrtc/p2p/base/udpport.h"
|
||||
#include "webrtc/base/asynctcpsocket.h"
|
||||
#include "webrtc/base/buffer.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/dscp.h"
|
||||
#include "webrtc/base/fakeclock.h"
|
||||
#include "webrtc/base/firewallsocketserver.h"
|
||||
@ -163,7 +164,7 @@ class TurnPortTest : public testing::Test,
|
||||
}
|
||||
|
||||
virtual void OnMessage(rtc::Message* msg) {
|
||||
ASSERT(msg->message_id == MSG_TESTFINISH);
|
||||
RTC_CHECK(msg->message_id == MSG_TESTFINISH);
|
||||
if (msg->message_id == MSG_TESTFINISH)
|
||||
test_finish_ = true;
|
||||
}
|
||||
@ -273,7 +274,7 @@ class TurnPortTest : public testing::Test,
|
||||
void CreateSharedTurnPort(const std::string& username,
|
||||
const std::string& password,
|
||||
const ProtocolAddress& server_address) {
|
||||
ASSERT(server_address.proto == PROTO_UDP);
|
||||
RTC_CHECK(server_address.proto == PROTO_UDP);
|
||||
|
||||
if (!socket_) {
|
||||
socket_.reset(socket_factory_.CreateUdpSocket(
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include "webrtc/base/array_view.h"
|
||||
#include "webrtc/base/buffer.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/fakeclock.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
@ -1268,8 +1269,8 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
|
||||
// Test that we properly send SRTP with RTCP in both directions.
|
||||
// You can pass in DTLS and/or RTCP_MUX as flags.
|
||||
void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) {
|
||||
ASSERT((flags1_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0);
|
||||
ASSERT((flags2_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0);
|
||||
RTC_CHECK((flags1_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0);
|
||||
RTC_CHECK((flags2_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0);
|
||||
|
||||
int flags1 = SECURE | flags1_in;
|
||||
int flags2 = SECURE | flags2_in;
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/fakesslidentity.h"
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/messagedigest.h"
|
||||
@ -451,10 +452,10 @@ class MediaSessionDescriptionFactoryTest : public testing::Test {
|
||||
|
||||
bool VerifyNoCNCodecs(const cricket::ContentInfo* content) {
|
||||
const cricket::ContentDescription* description = content->description;
|
||||
ASSERT(description != NULL);
|
||||
RTC_CHECK(description != NULL);
|
||||
const cricket::AudioContentDescription* audio_content_desc =
|
||||
static_cast<const cricket::AudioContentDescription*>(description);
|
||||
ASSERT(audio_content_desc != NULL);
|
||||
RTC_CHECK(audio_content_desc != NULL);
|
||||
for (size_t i = 0; i < audio_content_desc->codecs().size(); ++i) {
|
||||
if (audio_content_desc->codecs()[i].name == "CN")
|
||||
return false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user