Reenables several NetEq unittests on android.

Several unittests were disabled on android, this CL will reenable them. One of
the tests was accidentally disabled on all platforms, and now no longer gives a
bitexact result.

BUG=webrtc:3343,webrtc:5349

Review URL: https://codereview.webrtc.org/1532903002

Cr-Original-Commit-Position: refs/heads/master@{#11323}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 72c08edcedd67355b6d454dddad4580348205ee0
diff --git a/modules/audio_coding/neteq/neteq_stereo_unittest.cc b/modules/audio_coding/neteq/neteq_stereo_unittest.cc
index d3f59ec..0b4754d 100644
--- a/modules/audio_coding/neteq/neteq_stereo_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_stereo_unittest.cc
@@ -161,7 +161,7 @@
     return next_send_time;
   }
 
-  void VerifyOutput(size_t num_samples) {
+  virtual void VerifyOutput(size_t num_samples) {
     for (size_t i = 0; i < num_samples; ++i) {
       for (size_t j = 0; j < num_channels_; ++j) {
         ASSERT_EQ(output_[i], output_multi_channel_[i * num_channels_ + j]) <<
@@ -275,12 +275,7 @@
   }
 };
 
-#if defined(WEBRTC_ANDROID)
-#define MAYBE_RunTest DISABLED_RunTest
-#else
-#define MAYBE_RunTest RunTest
-#endif
-TEST_P(NetEqStereoTestNoJitter, MAYBE_RunTest) {
+TEST_P(NetEqStereoTestNoJitter, RunTest) {
   RunTest(8);
 }
 
@@ -305,7 +300,7 @@
   double drift_factor;
 };
 
-TEST_P(NetEqStereoTestPositiveDrift, MAYBE_RunTest) {
+TEST_P(NetEqStereoTestPositiveDrift, RunTest) {
   RunTest(100);
 }
 
@@ -318,7 +313,7 @@
   }
 };
 
-TEST_P(NetEqStereoTestNegativeDrift, MAYBE_RunTest) {
+TEST_P(NetEqStereoTestNegativeDrift, RunTest) {
   RunTest(100);
 }
 
@@ -346,7 +341,7 @@
   int frame_index_;
 };
 
-TEST_P(NetEqStereoTestDelays, MAYBE_RunTest) {
+TEST_P(NetEqStereoTestDelays, RunTest) {
   RunTest(1000);
 }
 
@@ -362,13 +357,25 @@
     return (++frame_index_) % kLossInterval == 0;
   }
 
+  // TODO(hlundin): NetEq is not giving bitexact results for these cases.
+  virtual void VerifyOutput(size_t num_samples) {
+    for (size_t i = 0; i < num_samples; ++i) {
+      auto first_channel_sample = output_multi_channel_[i * num_channels_];
+      for (size_t j = 0; j < num_channels_; ++j) {
+        const int kErrorMargin = 200;
+        EXPECT_NEAR(output_[i], output_multi_channel_[i * num_channels_ + j],
+                    kErrorMargin)
+            << "Diff in sample " << i << ", channel " << j << ".";
+        EXPECT_EQ(first_channel_sample,
+                  output_multi_channel_[i * num_channels_ + j]);
+      }
+    }
+  }
+
   int frame_index_;
 };
 
-// TODO(pbos): Enable on non-Android, this went failing while being accidentally
-// disabled on all platforms and not just Android.
-// https://bugs.chromium.org/p/webrtc/issues/detail?id=5387
-TEST_P(NetEqStereoTestLosses, DISABLED_RunTest) {
+TEST_P(NetEqStereoTestLosses, RunTest) {
   RunTest(100);
 }
 
diff --git a/modules/audio_coding/neteq/neteq_unittest.cc b/modules/audio_coding/neteq/neteq_unittest.cc
index 8d52c61..f218f72 100644
--- a/modules/audio_coding/neteq/neteq_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_unittest.cc
@@ -412,6 +412,10 @@
     if (packet_->payload_length_bytes() > 0) {
       WebRtcRTPHeader rtp_header;
       packet_->ConvertHeader(&rtp_header);
+#ifndef WEBRTC_CODEC_ISAC
+      // Ignore payload type 104 (iSAC-swb) if ISAC is not supported.
+      if (rtp_header.header.payloadType != 104)
+#endif
       ASSERT_EQ(0, neteq_->InsertPacket(
                        rtp_header,
                        rtc::ArrayView<const uint8_t>(
@@ -515,10 +519,10 @@
   *payload_len = 1;  // Only noise level, no spectral parameters.
 }
 
-#if !defined(WEBRTC_IOS) && !defined(WEBRTC_ANDROID) &&             \
-    defined(WEBRTC_NETEQ_UNITTEST_BITEXACT) &&                      \
-    (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \
-    defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722)
+#if !defined(WEBRTC_IOS) && defined(WEBRTC_NETEQ_UNITTEST_BITEXACT) && \
+    (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) &&    \
+    defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722) &&        \
+    !defined(WEBRTC_ARCH_ARM64)
 #define MAYBE_TestBitExactness TestBitExactness
 #else
 #define MAYBE_TestBitExactness DISABLED_TestBitExactness
@@ -929,12 +933,12 @@
   EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError());
 }
 
-#if defined(WEBRTC_ANDROID)
-#define MAYBE_DecoderError DISABLED_DecoderError
-#else
-#define MAYBE_DecoderError DecoderError
-#endif
 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
+#define MAYBE_DecoderError DecoderError
+#else
+#define MAYBE_DecoderError DISABLED_DecoderError
+#endif
+
 TEST_F(NetEqDecodingTest, MAYBE_DecoderError) {
   const size_t kPayloadBytes = 100;
   uint8_t payload[kPayloadBytes] = {0};
@@ -955,8 +959,16 @@
                              &samples_per_channel, &num_channels, &type));
   // Verify that there is a decoder error to check.
   EXPECT_EQ(NetEq::kDecoderErrorCode, neteq_->LastError());
-  // Code 6730 is an iSAC error code.
-  EXPECT_EQ(6730, neteq_->LastDecoderError());
+
+  enum NetEqDecoderError {
+    ISAC_LENGTH_MISMATCH = 6730,
+    ISAC_RANGE_ERROR_DECODE_FRAME_LENGTH = 6640
+  };
+#if defined(WEBRTC_CODEC_ISAC)
+  EXPECT_EQ(ISAC_LENGTH_MISMATCH, neteq_->LastDecoderError());
+#elif defined(WEBRTC_CODEC_ISACFX)
+  EXPECT_EQ(ISAC_RANGE_ERROR_DECODE_FRAME_LENGTH, neteq_->LastDecoderError());
+#endif
   // Verify that the first 160 samples are set to 0, and that the remaining
   // samples are left unmodified.
   static const int kExpectedOutputLength = 160;  // 10 ms at 16 kHz sample rate.
@@ -973,7 +985,6 @@
     EXPECT_EQ(1, out_data_[i]);
   }
 }
-#endif
 
 TEST_F(NetEqDecodingTest, GetAudioBeforeInsertPacket) {
   NetEqOutputType type;
@@ -1172,7 +1183,11 @@
 }
 
 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
-TEST_F(NetEqDecodingTest, SyncPacketInsert) {
+#define MAYBE_SyncPacketInsert SyncPacketInsert
+#else
+#define MAYBE_SyncPacketInsert DISABLED_SyncPacketInsert
+#endif
+TEST_F(NetEqDecodingTest, MAYBE_SyncPacketInsert) {
   WebRtcRTPHeader rtp_info;
   uint32_t receive_timestamp = 0;
   // For the readability use the following payloads instead of the defaults of
@@ -1251,7 +1266,6 @@
   --rtp_info.header.ssrc;
   EXPECT_EQ(0, neteq_->InsertSyncPacket(rtp_info, receive_timestamp));
 }
-#endif
 
 // First insert several noise like packets, then sync-packets. Decoding all
 // packets should not produce error, statistics should not show any packet loss
diff --git a/modules/modules_unittests.isolate b/modules/modules_unittests.isolate
index d988821..c81197c 100644
--- a/modules/modules_unittests.isolate
+++ b/modules/modules_unittests.isolate
@@ -11,6 +11,9 @@
       'variables': {
         'files': [
           '<(DEPTH)/data/audio_processing/output_data_fixed.pb',
+          '<(DEPTH)/resources/audio_coding/neteq4_network_stats_android.dat',
+          '<(DEPTH)/resources/audio_coding/neteq4_rtcp_stats_android.dat',
+          '<(DEPTH)/resources/audio_coding/neteq4_universal_ref_android.pcm',
         ],
       },
     }],
diff --git a/test/testsupport/fileutils.cc b/test/testsupport/fileutils.cc
index 15abf5c..4ff0034 100644
--- a/test/testsupport/fileutils.cc
+++ b/test/testsupport/fileutils.cc
@@ -222,6 +222,9 @@
 #ifdef WEBRTC_MAC
   platform = "mac";
 #endif  // WEBRTC_MAC
+#ifdef WEBRTC_ANDROID
+  platform = "android";
+#endif  // WEBRTC_ANDROID
 
 #ifdef WEBRTC_ARCH_64_BITS
   std::string architecture = "64";