Add ability to disable detailed error message in RTC_CHECKs
Bug: webrtc:11133 Change-Id: I989654f1fb97b476a17956d69ee374406439ea8f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160653 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29952}
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/mock_audio_encoder.h"
|
||||
#include "test/testsupport/rtc_expect_death.h"
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::InSequence;
|
||||
@ -441,7 +442,7 @@ class AudioEncoderCngDeathTest : public AudioEncoderCngTest {
|
||||
}
|
||||
|
||||
void TryWrongNumCoefficients(int num) {
|
||||
EXPECT_DEATH(
|
||||
RTC_EXPECT_DEATH(
|
||||
[&] {
|
||||
auto config = MakeCngConfig();
|
||||
config.num_cng_coefficients = num;
|
||||
@ -454,9 +455,9 @@ class AudioEncoderCngDeathTest : public AudioEncoderCngTest {
|
||||
TEST_F(AudioEncoderCngDeathTest, WrongFrameSize) {
|
||||
CreateCng(MakeCngConfig());
|
||||
num_audio_samples_10ms_ *= 2; // 20 ms frame.
|
||||
EXPECT_DEATH(Encode(), "");
|
||||
RTC_EXPECT_DEATH(Encode(), "");
|
||||
num_audio_samples_10ms_ = 0; // Zero samples.
|
||||
EXPECT_DEATH(Encode(), "");
|
||||
RTC_EXPECT_DEATH(Encode(), "");
|
||||
}
|
||||
|
||||
TEST_F(AudioEncoderCngDeathTest, WrongNumCoefficientsA) {
|
||||
@ -474,16 +475,16 @@ TEST_F(AudioEncoderCngDeathTest, WrongNumCoefficientsC) {
|
||||
TEST_F(AudioEncoderCngDeathTest, NullSpeechEncoder) {
|
||||
auto config = MakeCngConfig();
|
||||
config.speech_encoder = nullptr;
|
||||
EXPECT_DEATH(CreateCng(std::move(config)), "");
|
||||
RTC_EXPECT_DEATH(CreateCng(std::move(config)), "");
|
||||
}
|
||||
|
||||
TEST_F(AudioEncoderCngDeathTest, StereoEncoder) {
|
||||
EXPECT_CALL(*mock_encoder_, NumChannels()).WillRepeatedly(Return(2));
|
||||
EXPECT_DEATH(CreateCng(MakeCngConfig()), "Invalid configuration");
|
||||
RTC_EXPECT_DEATH(CreateCng(MakeCngConfig()), "Invalid configuration");
|
||||
}
|
||||
|
||||
TEST_F(AudioEncoderCngDeathTest, StereoConfig) {
|
||||
EXPECT_DEATH(
|
||||
RTC_EXPECT_DEATH(
|
||||
[&] {
|
||||
auto config = MakeCngConfig();
|
||||
config.num_channels = 2;
|
||||
@ -498,8 +499,8 @@ TEST_F(AudioEncoderCngDeathTest, EncoderFrameSizeTooLarge) {
|
||||
.WillRepeatedly(Return(7U));
|
||||
for (int i = 0; i < 6; ++i)
|
||||
Encode();
|
||||
EXPECT_DEATH(Encode(),
|
||||
"Frame size cannot be larger than 60 ms when using VAD/CNG.");
|
||||
RTC_EXPECT_DEATH(
|
||||
Encode(), "Frame size cannot be larger than 60 ms when using VAD/CNG.");
|
||||
}
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/mock_audio_encoder.h"
|
||||
#include "test/testsupport/rtc_expect_death.h"
|
||||
|
||||
using ::testing::_;
|
||||
using ::testing::InSequence;
|
||||
@ -285,17 +286,17 @@ class AudioEncoderCopyRedDeathTest : public AudioEncoderCopyRedTest {
|
||||
|
||||
TEST_F(AudioEncoderCopyRedDeathTest, WrongFrameSize) {
|
||||
num_audio_samples_10ms *= 2; // 20 ms frame.
|
||||
EXPECT_DEATH(Encode(), "");
|
||||
RTC_EXPECT_DEATH(Encode(), "");
|
||||
num_audio_samples_10ms = 0; // Zero samples.
|
||||
EXPECT_DEATH(Encode(), "");
|
||||
RTC_EXPECT_DEATH(Encode(), "");
|
||||
}
|
||||
|
||||
TEST_F(AudioEncoderCopyRedDeathTest, NullSpeechEncoder) {
|
||||
AudioEncoderCopyRed* red = NULL;
|
||||
AudioEncoderCopyRed::Config config;
|
||||
config.speech_encoder = NULL;
|
||||
EXPECT_DEATH(red = new AudioEncoderCopyRed(std::move(config)),
|
||||
"Speech encoder not provided.");
|
||||
RTC_EXPECT_DEATH(red = new AudioEncoderCopyRed(std::move(config)),
|
||||
"Speech encoder not provided.");
|
||||
// The delete operation is needed to avoid leak reports from memcheck.
|
||||
delete red;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user