Rename several more tests that use EXPECT_DEATH to *DeathTest.

Bug: webrtc:11577
Change-Id: I0397ee933464496e4885bb0f8030f3d669e5e612
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175641
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31309}
This commit is contained in:
Tommi 2020-05-18 16:47:56 +02:00 committed by Commit Bot
parent 31c61c5091
commit 909f3a5339
14 changed files with 86 additions and 69 deletions

View file

@ -38,7 +38,7 @@ void CallFixed(ArrayView<T, N> av) {}
} // namespace
TEST(ArrayViewTest, TestConstructFromPtrAndArray) {
TEST(ArrayViewDeathTest, TestConstructFromPtrAndArray) {
char arr[] = "Arrr!";
const char carr[] = "Carrr!";
EXPECT_EQ(6u, Call<const char>(arr));
@ -409,7 +409,7 @@ TEST(FixArrayViewTest, TestSwapFixed) {
// swap(x, w); // Compile error, because different sizes.
}
TEST(ArrayViewTest, TestIndexing) {
TEST(ArrayViewDeathTest, TestIndexing) {
char arr[] = "abcdefg";
ArrayView<char> x(arr);
const ArrayView<char> y(arr);

View file

@ -141,14 +141,16 @@ TEST_F(RtcEventLogOutputFileTest, AllowReasonableFileSizeLimits) {
}
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST_F(RtcEventLogOutputFileTest, WritingToInactiveFileForbidden) {
class RtcEventLogOutputFileDeathTest : public RtcEventLogOutputFileTest {};
TEST_F(RtcEventLogOutputFileDeathTest, WritingToInactiveFileForbidden) {
RtcEventLogOutputFile output_file(output_file_name_, 2);
ASSERT_FALSE(output_file.Write("abc"));
ASSERT_FALSE(output_file.IsActive());
EXPECT_DEATH(output_file.Write("abc"), "");
}
TEST_F(RtcEventLogOutputFileTest, DisallowUnreasonableFileSizeLimits) {
TEST_F(RtcEventLogOutputFileDeathTest, DisallowUnreasonableFileSizeLimits) {
// Keeping in a temporary unique_ptr to make it clearer that the death is
// triggered by construction, not destruction.
std::unique_ptr<RtcEventLogOutputFile> output_file;

View file

@ -175,7 +175,7 @@ TEST(UnitConversionTest, DataRateAndDataSizeAndFrequency) {
EXPECT_EQ((rate_b / freq_a).bytes(), kBitsPerSecond / kHertz / 8);
}
TEST(UnitConversionTest, DivisionFailsOnLargeSize) {
TEST(UnitConversionDeathTest, DivisionFailsOnLargeSize) {
// Note that the failure is expected since the current implementation is
// implementated in a way that does not support division of large sizes. If
// the implementation is changed, this test can safely be removed.

View file

@ -27,6 +27,8 @@ class AudioFrameOperationsTest : public ::testing::Test {
AudioFrame frame_;
};
class AudioFrameOperationsDeathTest : public AudioFrameOperationsTest {};
void SetFrameData(int16_t ch1,
int16_t ch2,
int16_t ch3,
@ -105,7 +107,7 @@ void VerifyFrameDataBounds(const AudioFrame& frame,
}
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST_F(AudioFrameOperationsTest, MonoToStereoFailsWithBadParameters) {
TEST_F(AudioFrameOperationsDeathTest, MonoToStereoFailsWithBadParameters) {
EXPECT_DEATH(AudioFrameOperations::UpmixChannels(2, &frame_), "");
frame_.samples_per_channel_ = AudioFrame::kMaxDataSizeSamples;
frame_.num_channels_ = 1;
@ -136,7 +138,7 @@ TEST_F(AudioFrameOperationsTest, MonoToStereoMuted) {
}
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST_F(AudioFrameOperationsTest, StereoToMonoFailsWithBadParameters) {
TEST_F(AudioFrameOperationsDeathTest, StereoToMonoFailsWithBadParameters) {
frame_.num_channels_ = 1;
EXPECT_DEATH(AudioFrameOperations::DownmixChannels(1, &frame_), "");
}

View file

@ -81,6 +81,8 @@ class RtcpDemuxerTest : public ::testing::Test {
std::set<RtcpPacketSinkInterface*> broadcast_sinks_to_tear_down_;
};
class RtcpDemuxerDeathTest : public RtcpDemuxerTest {};
// Produces a packet buffer representing an RTCP packet with a given SSRC,
// as it would look when sent over the wire.
// |distinguishing_string| allows different RTCP packets with the same SSRC
@ -419,7 +421,7 @@ TEST_F(RtcpDemuxerTest, FirstResolutionOfRsidNotForgotten) {
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST_F(RtcpDemuxerTest, RepeatedSsrcToSinkAssociationsDisallowed) {
TEST_F(RtcpDemuxerDeathTest, RepeatedSsrcToSinkAssociationsDisallowed) {
MockRtcpPacketSink sink;
constexpr uint32_t ssrc = 101;
@ -427,7 +429,7 @@ TEST_F(RtcpDemuxerTest, RepeatedSsrcToSinkAssociationsDisallowed) {
EXPECT_DEATH(AddSsrcSink(ssrc, &sink), "");
}
TEST_F(RtcpDemuxerTest, RepeatedRsidToSinkAssociationsDisallowed) {
TEST_F(RtcpDemuxerDeathTest, RepeatedRsidToSinkAssociationsDisallowed) {
MockRtcpPacketSink sink;
const std::string rsid = "z";
@ -435,14 +437,14 @@ TEST_F(RtcpDemuxerTest, RepeatedRsidToSinkAssociationsDisallowed) {
EXPECT_DEATH(AddRsidSink(rsid, &sink), "");
}
TEST_F(RtcpDemuxerTest, RepeatedBroadcastSinkRegistrationDisallowed) {
TEST_F(RtcpDemuxerDeathTest, RepeatedBroadcastSinkRegistrationDisallowed) {
MockRtcpPacketSink sink;
AddBroadcastSink(&sink);
EXPECT_DEATH(AddBroadcastSink(&sink), "");
}
TEST_F(RtcpDemuxerTest, SsrcSinkCannotAlsoBeRegisteredAsBroadcast) {
TEST_F(RtcpDemuxerDeathTest, SsrcSinkCannotAlsoBeRegisteredAsBroadcast) {
MockRtcpPacketSink sink;
constexpr uint32_t ssrc = 101;
@ -450,7 +452,7 @@ TEST_F(RtcpDemuxerTest, SsrcSinkCannotAlsoBeRegisteredAsBroadcast) {
EXPECT_DEATH(AddBroadcastSink(&sink), "");
}
TEST_F(RtcpDemuxerTest, RsidSinkCannotAlsoBeRegisteredAsBroadcast) {
TEST_F(RtcpDemuxerDeathTest, RsidSinkCannotAlsoBeRegisteredAsBroadcast) {
MockRtcpPacketSink sink;
const std::string rsid = "z";
@ -458,7 +460,7 @@ TEST_F(RtcpDemuxerTest, RsidSinkCannotAlsoBeRegisteredAsBroadcast) {
EXPECT_DEATH(AddBroadcastSink(&sink), "");
}
TEST_F(RtcpDemuxerTest, BroadcastSinkCannotAlsoBeRegisteredAsSsrcSink) {
TEST_F(RtcpDemuxerDeathTest, BroadcastSinkCannotAlsoBeRegisteredAsSsrcSink) {
MockRtcpPacketSink sink;
AddBroadcastSink(&sink);
@ -466,7 +468,7 @@ TEST_F(RtcpDemuxerTest, BroadcastSinkCannotAlsoBeRegisteredAsSsrcSink) {
EXPECT_DEATH(AddSsrcSink(ssrc, &sink), "");
}
TEST_F(RtcpDemuxerTest, BroadcastSinkCannotAlsoBeRegisteredAsRsidSink) {
TEST_F(RtcpDemuxerDeathTest, BroadcastSinkCannotAlsoBeRegisteredAsRsidSink) {
MockRtcpPacketSink sink;
AddBroadcastSink(&sink);
@ -474,27 +476,27 @@ TEST_F(RtcpDemuxerTest, BroadcastSinkCannotAlsoBeRegisteredAsRsidSink) {
EXPECT_DEATH(AddRsidSink(rsid, &sink), "");
}
TEST_F(RtcpDemuxerTest, MayNotCallRemoveSinkOnNeverAddedSink) {
TEST_F(RtcpDemuxerDeathTest, MayNotCallRemoveSinkOnNeverAddedSink) {
MockRtcpPacketSink sink;
EXPECT_DEATH(RemoveSink(&sink), "");
}
TEST_F(RtcpDemuxerTest, MayNotCallRemoveBroadcastSinkOnNeverAddedSink) {
TEST_F(RtcpDemuxerDeathTest, MayNotCallRemoveBroadcastSinkOnNeverAddedSink) {
MockRtcpPacketSink sink;
EXPECT_DEATH(RemoveBroadcastSink(&sink), "");
}
TEST_F(RtcpDemuxerTest, RsidMustBeNonEmpty) {
TEST_F(RtcpDemuxerDeathTest, RsidMustBeNonEmpty) {
MockRtcpPacketSink sink;
EXPECT_DEATH(AddRsidSink("", &sink), "");
}
TEST_F(RtcpDemuxerTest, RsidMustBeAlphaNumeric) {
TEST_F(RtcpDemuxerDeathTest, RsidMustBeAlphaNumeric) {
MockRtcpPacketSink sink;
EXPECT_DEATH(AddRsidSink("a_3", &sink), "");
}
TEST_F(RtcpDemuxerTest, RsidMustNotExceedMaximumLength) {
TEST_F(RtcpDemuxerDeathTest, RsidMustNotExceedMaximumLength) {
MockRtcpPacketSink sink;
std::string rsid(BaseRtpStringExtension::kMaxValueSizeBytes + 1, 'a');
EXPECT_DEATH(AddRsidSink(rsid, &sink), "");

View file

@ -218,6 +218,8 @@ class RtpDemuxerTest : public ::testing::Test {
uint16_t next_sequence_number_ = 1;
};
class RtpDemuxerDeathTest : public RtpDemuxerTest {};
MATCHER_P(SamePacketAs, other, "") {
return arg.Ssrc() == other.Ssrc() &&
arg.SequenceNumber() == other.SequenceNumber();
@ -1486,41 +1488,42 @@ TEST_F(RtpDemuxerTest, MaliciousPeerCannotCauseMemoryOveruse) {
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST_F(RtpDemuxerTest, CriteriaMustBeNonEmpty) {
TEST_F(RtpDemuxerDeathTest, CriteriaMustBeNonEmpty) {
MockRtpPacketSink sink;
RtpDemuxerCriteria criteria;
EXPECT_DEATH(AddSink(criteria, &sink), "");
}
TEST_F(RtpDemuxerTest, RsidMustBeAlphaNumeric) {
TEST_F(RtpDemuxerDeathTest, RsidMustBeAlphaNumeric) {
MockRtpPacketSink sink;
EXPECT_DEATH(AddSinkOnlyRsid("a_3", &sink), "");
}
TEST_F(RtpDemuxerTest, MidMustBeToken) {
TEST_F(RtpDemuxerDeathTest, MidMustBeToken) {
MockRtpPacketSink sink;
EXPECT_DEATH(AddSinkOnlyMid("a(3)", &sink), "");
}
TEST_F(RtpDemuxerTest, RsidMustNotExceedMaximumLength) {
TEST_F(RtpDemuxerDeathTest, RsidMustNotExceedMaximumLength) {
MockRtpPacketSink sink;
std::string rsid(BaseRtpStringExtension::kMaxValueSizeBytes + 1, 'a');
EXPECT_DEATH(AddSinkOnlyRsid(rsid, &sink), "");
}
TEST_F(RtpDemuxerTest, MidMustNotExceedMaximumLength) {
TEST_F(RtpDemuxerDeathTest, MidMustNotExceedMaximumLength) {
MockRtpPacketSink sink;
std::string mid(BaseRtpStringExtension::kMaxValueSizeBytes + 1, 'a');
EXPECT_DEATH(AddSinkOnlyMid(mid, &sink), "");
}
TEST_F(RtpDemuxerTest, DoubleRegisterationOfSsrcBindingObserverDisallowed) {
TEST_F(RtpDemuxerDeathTest,
DoubleRegisterationOfSsrcBindingObserverDisallowed) {
MockSsrcBindingObserver observer;
RegisterSsrcBindingObserver(&observer);
EXPECT_DEATH(RegisterSsrcBindingObserver(&observer), "");
}
TEST_F(RtpDemuxerTest,
TEST_F(RtpDemuxerDeathTest,
DregisterationOfNeverRegisteredSsrcBindingObserverDisallowed) {
MockSsrcBindingObserver observer;
EXPECT_DEATH(DeregisterSsrcBindingObserver(&observer), "");

View file

@ -53,12 +53,12 @@ TEST(IFChannelBufferTest, SettingNumChannelsOfOneChannelBufferSetsTheOther) {
}
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST(ChannelBufferTest, SetNumChannelsDeathTest) {
TEST(ChannelBufferDeathTest, SetNumChannelsDeathTest) {
ChannelBuffer<float> chb(kNumFrames, kMono);
RTC_EXPECT_DEATH(chb.set_num_channels(kStereo), "num_channels");
}
TEST(IFChannelBufferTest, SetNumChannelsDeathTest) {
TEST(IFChannelBufferDeathTest, SetNumChannelsDeathTest) {
IFChannelBuffer ifchb(kNumFrames, kMono);
RTC_EXPECT_DEATH(ifchb.ibuf()->set_num_channels(kStereo), "num_channels");
}

View file

@ -31,19 +31,19 @@ TEST(PushResamplerTest, VerifiesInputParameters) {
}
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST(PushResamplerTest, VerifiesBadInputParameters1) {
TEST(PushResamplerDeathTest, VerifiesBadInputParameters1) {
PushResampler<int16_t> resampler;
RTC_EXPECT_DEATH(resampler.InitializeIfNeeded(-1, 16000, 1),
"src_sample_rate_hz");
}
TEST(PushResamplerTest, VerifiesBadInputParameters2) {
TEST(PushResamplerDeathTest, VerifiesBadInputParameters2) {
PushResampler<int16_t> resampler;
RTC_EXPECT_DEATH(resampler.InitializeIfNeeded(16000, -1, 1),
"dst_sample_rate_hz");
}
TEST(PushResamplerTest, VerifiesBadInputParameters3) {
TEST(PushResamplerDeathTest, VerifiesBadInputParameters3) {
PushResampler<int16_t> resampler;
RTC_EXPECT_DEATH(resampler.InitializeIfNeeded(16000, 16000, 0),
"num_channels");

View file

@ -252,6 +252,9 @@ class AudioCodingModuleTestOldApi : public ::testing::Test {
Clock* clock_;
};
class AudioCodingModuleTestOldApiDeathTest
: public AudioCodingModuleTestOldApi {};
TEST_F(AudioCodingModuleTestOldApi, VerifyOutputFrame) {
AudioFrame audio_frame;
const int kSampleRateHz = 32000;
@ -271,7 +274,7 @@ TEST_F(AudioCodingModuleTestOldApi, VerifyOutputFrame) {
// http://crbug.com/615050
#if !defined(WEBRTC_WIN) && defined(__clang__) && RTC_DCHECK_IS_ON && \
GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST_F(AudioCodingModuleTestOldApi, FailOnZeroDesiredFrequency) {
TEST_F(AudioCodingModuleTestOldApiDeathTest, FailOnZeroDesiredFrequency) {
AudioFrame audio_frame;
bool muted;
RTC_EXPECT_DEATH(acm_->PlayoutData10Ms(0, &audio_frame, &muted),

View file

@ -621,7 +621,7 @@ TEST(ThresholdCurveTest, NearlyIdenticalCurvesSecondContinuesOnOtherRightSide) {
// The higher-left point must be given as the first point, and the lower-right
// point must be given as the second.
// This necessarily produces a non-positive slope.
TEST(ThresholdCurveTest, WrongOrderPoints) {
TEST(ThresholdCurveDeathTest, WrongOrderPoints) {
std::unique_ptr<ThresholdCurve> curve;
constexpr ThresholdCurve::Point left{5, 10};
constexpr ThresholdCurve::Point right{10, 5};

View file

@ -40,6 +40,8 @@ class CngTest : public ::testing::Test {
int16_t speech_data_[640]; // Max size of CNG internal buffers.
};
class CngDeathTest : public CngTest {};
void CngTest::SetUp() {
FILE* input_file;
const std::string file_name =
@ -69,7 +71,7 @@ void CngTest::TestCngEncode(int sample_rate_hz, int quality) {
#if GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
// Create CNG encoder, init with faulty values, free CNG encoder.
TEST_F(CngTest, CngInitFail) {
TEST_F(CngDeathTest, CngInitFail) {
// Call with too few parameters.
EXPECT_DEATH(
{
@ -86,7 +88,7 @@ TEST_F(CngTest, CngInitFail) {
}
// Encode Cng with too long input vector.
TEST_F(CngTest, CngEncodeTooLong) {
TEST_F(CngDeathTest, CngEncodeTooLong) {
rtc::Buffer sid_data;
// Create encoder.

View file

@ -20,28 +20,28 @@ namespace webrtc {
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
// Verifies that the check for non-null input in Fft works.
TEST(Aec3Fft, NullFftInput) {
TEST(Aec3FftDeathTest, NullFftInput) {
Aec3Fft fft;
FftData X;
EXPECT_DEATH(fft.Fft(nullptr, &X), "");
}
// Verifies that the check for non-null input in Fft works.
TEST(Aec3Fft, NullFftOutput) {
TEST(Aec3FftDeathTest, NullFftOutput) {
Aec3Fft fft;
std::array<float, kFftLength> x;
EXPECT_DEATH(fft.Fft(&x, nullptr), "");
}
// Verifies that the check for non-null output in Ifft works.
TEST(Aec3Fft, NullIfftOutput) {
TEST(Aec3FftDeathTest, NullIfftOutput) {
Aec3Fft fft;
FftData X;
EXPECT_DEATH(fft.Ifft(X, nullptr), "");
}
// Verifies that the check for non-null output in ZeroPaddedFft works.
TEST(Aec3Fft, NullZeroPaddedFftOutput) {
TEST(Aec3FftDeathTest, NullZeroPaddedFftOutput) {
Aec3Fft fft;
std::array<float, kFftLengthBy2> x;
EXPECT_DEATH(fft.ZeroPaddedFft(x, Aec3Fft::Window::kRectangular, nullptr),
@ -49,7 +49,7 @@ TEST(Aec3Fft, NullZeroPaddedFftOutput) {
}
// Verifies that the check for input length in ZeroPaddedFft works.
TEST(Aec3Fft, ZeroPaddedFftWrongInputLength) {
TEST(Aec3FftDeathTest, ZeroPaddedFftWrongInputLength) {
Aec3Fft fft;
FftData X;
std::array<float, kFftLengthBy2 - 1> x;
@ -57,7 +57,7 @@ TEST(Aec3Fft, ZeroPaddedFftWrongInputLength) {
}
// Verifies that the check for non-null output in PaddedFft works.
TEST(Aec3Fft, NullPaddedFftOutput) {
TEST(Aec3FftDeathTest, NullPaddedFftOutput) {
Aec3Fft fft;
std::array<float, kFftLengthBy2> x;
std::array<float, kFftLengthBy2> x_old;
@ -65,7 +65,7 @@ TEST(Aec3Fft, NullPaddedFftOutput) {
}
// Verifies that the check for input length in PaddedFft works.
TEST(Aec3Fft, PaddedFftWrongInputLength) {
TEST(Aec3FftDeathTest, PaddedFftWrongInputLength) {
Aec3Fft fft;
FftData X;
std::array<float, kFftLengthBy2 - 1> x;
@ -74,7 +74,7 @@ TEST(Aec3Fft, PaddedFftWrongInputLength) {
}
// Verifies that the check for length in the old value in PaddedFft works.
TEST(Aec3Fft, PaddedFftWrongOldValuesLength) {
TEST(Aec3FftDeathTest, PaddedFftWrongOldValuesLength) {
Aec3Fft fft;
FftData X;
std::array<float, kFftLengthBy2> x;

View file

@ -214,7 +214,8 @@ std::string ProduceDebugText(int sample_rate_hz, size_t num_channels) {
} // namespace
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST(BlockFramer, WrongNumberOfBandsInBlockForInsertBlockAndExtractSubFrame) {
TEST(BlockFramerDeathTest,
WrongNumberOfBandsInBlockForInsertBlockAndExtractSubFrame) {
for (auto rate : {16000, 32000, 48000}) {
for (auto correct_num_channels : {1, 2, 8}) {
SCOPED_TRACE(ProduceDebugText(rate, correct_num_channels));
@ -227,7 +228,7 @@ TEST(BlockFramer, WrongNumberOfBandsInBlockForInsertBlockAndExtractSubFrame) {
}
}
TEST(BlockFramer,
TEST(BlockFramerDeathTest,
WrongNumberOfChannelsInBlockForInsertBlockAndExtractSubFrame) {
for (auto rate : {16000, 32000, 48000}) {
for (auto correct_num_channels : {1, 2, 8}) {
@ -241,7 +242,7 @@ TEST(BlockFramer,
}
}
TEST(BlockFramer,
TEST(BlockFramerDeathTest,
WrongNumberOfBandsInSubFrameForInsertBlockAndExtractSubFrame) {
for (auto rate : {16000, 32000, 48000}) {
for (auto correct_num_channels : {1, 2, 8}) {
@ -255,7 +256,7 @@ TEST(BlockFramer,
}
}
TEST(BlockFramer,
TEST(BlockFramerDeathTest,
WrongNumberOfChannelsInSubFrameForInsertBlockAndExtractSubFrame) {
for (auto rate : {16000, 32000, 48000}) {
for (auto correct_num_channels : {1, 2, 8}) {
@ -269,7 +270,8 @@ TEST(BlockFramer,
}
}
TEST(BlockFramer, WrongNumberOfSamplesInBlockForInsertBlockAndExtractSubFrame) {
TEST(BlockFramerDeathTest,
WrongNumberOfSamplesInBlockForInsertBlockAndExtractSubFrame) {
for (auto rate : {16000, 32000, 48000}) {
for (auto correct_num_channels : {1, 2, 8}) {
SCOPED_TRACE(ProduceDebugText(rate, correct_num_channels));
@ -282,7 +284,7 @@ TEST(BlockFramer, WrongNumberOfSamplesInBlockForInsertBlockAndExtractSubFrame) {
}
}
TEST(BlockFramer,
TEST(BlockFramerDeathTest,
WrongNumberOfSamplesInSubFrameForInsertBlockAndExtractSubFrame) {
const size_t correct_num_channels = 1;
for (auto rate : {16000, 32000, 48000}) {
@ -295,7 +297,7 @@ TEST(BlockFramer,
}
}
TEST(BlockFramer, WrongNumberOfBandsInBlockForInsertBlock) {
TEST(BlockFramerDeathTest, WrongNumberOfBandsInBlockForInsertBlock) {
for (auto rate : {16000, 32000, 48000}) {
for (auto correct_num_channels : {1, 2, 8}) {
SCOPED_TRACE(ProduceDebugText(rate, correct_num_channels));
@ -308,7 +310,7 @@ TEST(BlockFramer, WrongNumberOfBandsInBlockForInsertBlock) {
}
}
TEST(BlockFramer, WrongNumberOfChannelsInBlockForInsertBlock) {
TEST(BlockFramerDeathTest, WrongNumberOfChannelsInBlockForInsertBlock) {
for (auto rate : {16000, 32000, 48000}) {
for (auto correct_num_channels : {1, 2, 8}) {
SCOPED_TRACE(ProduceDebugText(rate, correct_num_channels));
@ -321,7 +323,7 @@ TEST(BlockFramer, WrongNumberOfChannelsInBlockForInsertBlock) {
}
}
TEST(BlockFramer, WrongNumberOfSamplesInBlockForInsertBlock) {
TEST(BlockFramerDeathTest, WrongNumberOfSamplesInBlockForInsertBlock) {
for (auto rate : {16000, 32000, 48000}) {
for (auto correct_num_channels : {1, 2, 8}) {
SCOPED_TRACE(ProduceDebugText(rate, correct_num_channels));
@ -333,7 +335,7 @@ TEST(BlockFramer, WrongNumberOfSamplesInBlockForInsertBlock) {
}
}
TEST(BlockFramer, WrongNumberOfPreceedingApiCallsForInsertBlock) {
TEST(BlockFramerDeathTest, WrongNumberOfPreceedingApiCallsForInsertBlock) {
for (size_t num_channels : {1, 2, 8}) {
for (auto rate : {16000, 32000, 48000}) {
for (size_t num_calls = 0; num_calls < 4; ++num_calls) {
@ -351,17 +353,17 @@ TEST(BlockFramer, WrongNumberOfPreceedingApiCallsForInsertBlock) {
}
// Verifies that the verification for 0 number of channels works.
TEST(BlockFramer, ZeroNumberOfChannelsParameter) {
TEST(BlockFramerDeathTest, ZeroNumberOfChannelsParameter) {
EXPECT_DEATH(BlockFramer(16000, 0), "");
}
// Verifies that the verification for 0 number of bands works.
TEST(BlockFramer, ZeroNumberOfBandsParameter) {
TEST(BlockFramerDeathTest, ZeroNumberOfBandsParameter) {
EXPECT_DEATH(BlockFramer(0, 1), "");
}
// Verifies that the verification for null sub_frame pointer works.
TEST(BlockFramer, NullSubFrameParameter) {
TEST(BlockFramerDeathTest, NullSubFrameParameter) {
EXPECT_DEATH(BlockFramer(1, 1).InsertBlockAndExtractSubFrame(
std::vector<std::vector<std::vector<float>>>(
1, std::vector<std::vector<float>>(

View file

@ -287,7 +287,8 @@ std::string ProduceDebugText(int sample_rate_hz, size_t num_channels) {
} // namespace
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST(FrameBlocker, WrongNumberOfBandsInBlockForInsertSubFrameAndExtractBlock) {
TEST(FrameBlockerDeathTest,
WrongNumberOfBandsInBlockForInsertSubFrameAndExtractBlock) {
for (auto rate : {16000, 32000, 48000}) {
for (size_t correct_num_channels : {1, 2, 4, 8}) {
SCOPED_TRACE(ProduceDebugText(rate, correct_num_channels));
@ -300,7 +301,7 @@ TEST(FrameBlocker, WrongNumberOfBandsInBlockForInsertSubFrameAndExtractBlock) {
}
}
TEST(FrameBlocker,
TEST(FrameBlockerDeathTest,
WrongNumberOfChannelsInBlockForInsertSubFrameAndExtractBlock) {
for (auto rate : {16000, 32000, 48000}) {
for (size_t correct_num_channels : {1, 2, 4, 8}) {
@ -314,7 +315,7 @@ TEST(FrameBlocker,
}
}
TEST(FrameBlocker,
TEST(FrameBlockerDeathTest,
WrongNumberOfBandsInSubFrameForInsertSubFrameAndExtractBlock) {
for (auto rate : {16000, 32000, 48000}) {
for (size_t correct_num_channels : {1, 2, 4, 8}) {
@ -328,7 +329,7 @@ TEST(FrameBlocker,
}
}
TEST(FrameBlocker,
TEST(FrameBlockerDeathTest,
WrongNumberOfChannelsInSubFrameForInsertSubFrameAndExtractBlock) {
for (auto rate : {16000, 32000, 48000}) {
for (size_t correct_num_channels : {1, 2, 4, 8}) {
@ -342,7 +343,7 @@ TEST(FrameBlocker,
}
}
TEST(FrameBlocker,
TEST(FrameBlockerDeathTest,
WrongNumberOfSamplesInBlockForInsertSubFrameAndExtractBlock) {
for (auto rate : {16000, 32000, 48000}) {
for (size_t correct_num_channels : {1, 2, 4, 8}) {
@ -356,7 +357,7 @@ TEST(FrameBlocker,
}
}
TEST(FrameBlocker,
TEST(FrameBlockerDeathTest,
WrongNumberOfSamplesInSubFrameForInsertSubFrameAndExtractBlock) {
for (auto rate : {16000, 32000, 48000}) {
for (size_t correct_num_channels : {1, 2, 4, 8}) {
@ -370,7 +371,7 @@ TEST(FrameBlocker,
}
}
TEST(FrameBlocker, WrongNumberOfBandsInBlockForExtractBlock) {
TEST(FrameBlockerDeathTest, WrongNumberOfBandsInBlockForExtractBlock) {
for (auto rate : {16000, 32000, 48000}) {
for (size_t correct_num_channels : {1, 2, 4, 8}) {
SCOPED_TRACE(ProduceDebugText(rate, correct_num_channels));
@ -383,7 +384,7 @@ TEST(FrameBlocker, WrongNumberOfBandsInBlockForExtractBlock) {
}
}
TEST(FrameBlocker, WrongNumberOfChannelsInBlockForExtractBlock) {
TEST(FrameBlockerDeathTest, WrongNumberOfChannelsInBlockForExtractBlock) {
for (auto rate : {16000, 32000, 48000}) {
for (size_t correct_num_channels : {1, 2, 4, 8}) {
SCOPED_TRACE(ProduceDebugText(rate, correct_num_channels));
@ -396,7 +397,7 @@ TEST(FrameBlocker, WrongNumberOfChannelsInBlockForExtractBlock) {
}
}
TEST(FrameBlocker, WrongNumberOfSamplesInBlockForExtractBlock) {
TEST(FrameBlockerDeathTest, WrongNumberOfSamplesInBlockForExtractBlock) {
for (auto rate : {16000, 32000, 48000}) {
for (size_t correct_num_channels : {1, 2, 4, 8}) {
SCOPED_TRACE(ProduceDebugText(rate, correct_num_channels));
@ -408,7 +409,7 @@ TEST(FrameBlocker, WrongNumberOfSamplesInBlockForExtractBlock) {
}
}
TEST(FrameBlocker, WrongNumberOfPreceedingApiCallsForExtractBlock) {
TEST(FrameBlockerDeathTest, WrongNumberOfPreceedingApiCallsForExtractBlock) {
for (auto rate : {16000, 32000, 48000}) {
for (size_t num_channels : {1, 2, 4, 8}) {
for (size_t num_calls = 0; num_calls < 4; ++num_calls) {
@ -426,17 +427,17 @@ TEST(FrameBlocker, WrongNumberOfPreceedingApiCallsForExtractBlock) {
}
// Verifies that the verification for 0 number of channels works.
TEST(FrameBlocker, ZeroNumberOfChannelsParameter) {
TEST(FrameBlockerDeathTest, ZeroNumberOfChannelsParameter) {
EXPECT_DEATH(FrameBlocker(16000, 0), "");
}
// Verifies that the verification for 0 number of bands works.
TEST(FrameBlocker, ZeroNumberOfBandsParameter) {
TEST(FrameBlockerDeathTest, ZeroNumberOfBandsParameter) {
EXPECT_DEATH(FrameBlocker(0, 1), "");
}
// Verifiers that the verification for null sub_frame pointer works.
TEST(FrameBlocker, NullBlockParameter) {
TEST(FrameBlockerDeathTest, NullBlockParameter) {
std::vector<std::vector<std::vector<float>>> sub_frame(
1, std::vector<std::vector<float>>(
1, std::vector<float>(kSubFrameLength, 0.f)));