Bug 1296531 - Rename existing AudioTrackEncoder gtests to match TestVideoTrackEncoder. r?jesup
MozReview-Commit-ID: 6o5c35yGUL4
--- a/dom/media/gtest/TestAudioTrackEncoder.cpp
+++ b/dom/media/gtest/TestAudioTrackEncoder.cpp
@@ -57,25 +57,17 @@ CreateTestSegment()
static bool
TestOpusInit(int aChannels, int aSamplingRate)
{
TestOpusTrackEncoder encoder;
return encoder.TestOpusCreation(aChannels, aSamplingRate);
}
-static int
-TestOpusResampler(int aChannels, int aSamplingRate)
-{
- TestOpusTrackEncoder encoder;
- EXPECT_TRUE(encoder.TestOpusCreation(aChannels, aSamplingRate));
- return encoder.TestGetOutputSampleRate();
-}
-
-TEST(Media, OpusEncoder_Init)
+TEST(OpusAudioTrackEncoder, Init)
{
// Expect false with 0 or negative channels of input signal.
EXPECT_FALSE(TestOpusInit(0, 16000));
EXPECT_FALSE(TestOpusInit(-1, 16000));
// The Opus format supports up to 8 channels, and supports multitrack audio up
// to 255 channels, but the current implementation supports only mono and
// stereo, and downmixes any more than that.
@@ -96,17 +88,17 @@ TEST(Media, OpusEncoder_Init)
EXPECT_FALSE(TestOpusInit(2, 4000));
EXPECT_FALSE(TestOpusInit(2, 7999));
EXPECT_TRUE(TestOpusInit(2, 8000));
EXPECT_TRUE(TestOpusInit(2, 192000));
EXPECT_FALSE(TestOpusInit(2, 192001));
EXPECT_FALSE(TestOpusInit(2, 200000));
}
-TEST(Media, OpusEncoder_TryInit)
+TEST(OpusAudioTrackEncoder, TryInit)
{
{
// The encoder does not normally recieve enough info from null data to
// init. However, multiple attempts to do so, with sufficiently long
// duration segments, should result in a best effort attempt. The first
// attempt should never do this though, even if the duration is long:
TestOpusTrackEncoder encoder;
AudioSegment testSegment;
@@ -159,17 +151,25 @@ TEST(Media, OpusEncoder_TryInit)
{
// Test high sample rate bound
TestOpusTrackEncoder encoder;
AudioSegment testSegment = CreateTestSegment();
EXPECT_TRUE(encoder.TestOpusTryCreation(testSegment, 192000));
}
}
-TEST(Media, OpusEncoder_Resample)
+static int
+TestOpusResampler(int aChannels, int aSamplingRate)
+{
+ TestOpusTrackEncoder encoder;
+ EXPECT_TRUE(encoder.TestOpusCreation(aChannels, aSamplingRate));
+ return encoder.TestGetOutputSampleRate();
+}
+
+TEST(OpusAudioTrackEncoder, Resample)
{
// Sampling rates of data to be fed to Opus encoder, should remain unchanged
// if it is one of Opus supported rates (8000, 12000, 16000, 24000 and 48000
// (kHz)) at initialization.
EXPECT_TRUE(TestOpusResampler(1, 8000) == 8000);
EXPECT_TRUE(TestOpusResampler(1, 12000) == 12000);
EXPECT_TRUE(TestOpusResampler(1, 16000) == 16000);
EXPECT_TRUE(TestOpusResampler(1, 24000) == 24000);