Bug 1296531 - Rename existing AudioTrackEncoder gtests to match TestVideoTrackEncoder. r?jesup draft
authorAndreas Pehrson <pehrsons@gmail.com>
Fri, 17 Feb 2017 11:40:33 +0100
changeset 670304 f55ee2cce81d0c5761ce3f4a782a494cbd205fe4
parent 670303 1698d931abb899abeb897078d551603f7a6dac8d
child 670305 781fe7fc1263359c80176b5561fa07e63aa5f0a6
push id81598
push userbmo:apehrson@mozilla.com
push dateTue, 26 Sep 2017 09:13:19 +0000
reviewersjesup
bugs1296531
milestone58.0a1
Bug 1296531 - Rename existing AudioTrackEncoder gtests to match TestVideoTrackEncoder. r?jesup MozReview-Commit-ID: 6o5c35yGUL4
dom/media/gtest/TestAudioTrackEncoder.cpp
--- 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);