niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
tina.legrand@webrtc.org | 16b6b90 | 2012-04-12 11:02:38 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #include <stdio.h> |
kjellander@webrtc.org | 5490c71 | 2011-12-21 13:34:18 +0000 | [diff] [blame] | 12 | #include <string> |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | #include <vector> |
| 14 | |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 15 | #include "testing/gtest/include/gtest/gtest.h" |
turaj@webrtc.org | 6ea3d1c | 2013-10-02 21:44:33 +0000 | [diff] [blame] | 16 | #include "webrtc/common.h" |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 17 | #include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h" |
| 18 | #include "webrtc/modules/audio_coding/main/test/APITest.h" |
| 19 | #include "webrtc/modules/audio_coding/main/test/EncodeDecodeTest.h" |
| 20 | #include "webrtc/modules/audio_coding/main/test/iSACTest.h" |
| 21 | #include "webrtc/modules/audio_coding/main/test/opus_test.h" |
| 22 | #include "webrtc/modules/audio_coding/main/test/TestAllCodecs.h" |
| 23 | #include "webrtc/modules/audio_coding/main/test/TestFEC.h" |
| 24 | #include "webrtc/modules/audio_coding/main/test/TestStereo.h" |
| 25 | #include "webrtc/modules/audio_coding/main/test/TestVADDTX.h" |
| 26 | #include "webrtc/modules/audio_coding/main/test/TwoWayCommunication.h" |
turaj@webrtc.org | 6ea3d1c | 2013-10-02 21:44:33 +0000 | [diff] [blame] | 27 | #include "webrtc/modules/audio_coding/main/test/utility.h" |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 28 | #include "webrtc/system_wrappers/interface/trace.h" |
| 29 | #include "webrtc/test/testsupport/fileutils.h" |
henrike@webrtc.org | 89c6740 | 2013-08-02 16:53:47 +0000 | [diff] [blame] | 30 | #include "webrtc/test/testsupport/gtest_disable.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 31 | |
tina.legrand@webrtc.org | 554ae1a | 2011-12-16 10:09:04 +0000 | [diff] [blame] | 32 | using webrtc::Trace; |
| 33 | |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 34 | // This parameter is used to describe how to run the tests. It is normally |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 35 | // set to 0, and all tests are run in quite mode. |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 36 | #define ACM_TEST_MODE 0 |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 37 | |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 38 | TEST(AudioCodingModuleTest, TestAllCodecs) { |
| 39 | Trace::CreateTrace(); |
| 40 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
tina.legrand@webrtc.org | d5726a1 | 2013-05-03 07:34:12 +0000 | [diff] [blame] | 41 | "acm_allcodecs_trace.txt").c_str()); |
turaj@webrtc.org | 6ea3d1c | 2013-10-02 21:44:33 +0000 | [diff] [blame] | 42 | webrtc::Config config; |
| 43 | |
| 44 | UseLegacyAcm(&config); |
| 45 | webrtc::TestAllCodecs(ACM_TEST_MODE, config).Perform(); |
| 46 | |
| 47 | UseNewAcm(&config); |
| 48 | webrtc::TestAllCodecs(ACM_TEST_MODE, config).Perform(); |
| 49 | |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 50 | Trace::ReturnTrace(); |
| 51 | } |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 52 | |
turaj@webrtc.org | 7cc64b3 | 2014-01-10 22:35:09 +0000 | [diff] [blame^] | 53 | TEST(AudioCodingModuleTest, TestEncodeDecode) { |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 54 | Trace::CreateTrace(); |
| 55 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 56 | "acm_encodedecode_trace.txt").c_str()); |
turaj@webrtc.org | 6ea3d1c | 2013-10-02 21:44:33 +0000 | [diff] [blame] | 57 | webrtc::Config config; |
| 58 | |
| 59 | UseLegacyAcm(&config); |
| 60 | webrtc::EncodeDecodeTest(ACM_TEST_MODE, config).Perform(); |
| 61 | |
| 62 | UseNewAcm(&config); |
| 63 | webrtc::EncodeDecodeTest(ACM_TEST_MODE, config).Perform(); |
| 64 | |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 65 | Trace::ReturnTrace(); |
| 66 | } |
| 67 | |
turaj@webrtc.org | 7cc64b3 | 2014-01-10 22:35:09 +0000 | [diff] [blame^] | 68 | TEST(AudioCodingModuleTest, TestFEC) { |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 69 | Trace::CreateTrace(); |
| 70 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 71 | "acm_fec_trace.txt").c_str()); |
turaj@webrtc.org | 6ea3d1c | 2013-10-02 21:44:33 +0000 | [diff] [blame] | 72 | webrtc::Config config; |
| 73 | |
| 74 | UseLegacyAcm(&config); |
| 75 | webrtc::TestFEC(config).Perform(); |
| 76 | |
| 77 | UseNewAcm(&config); |
| 78 | webrtc::TestFEC(config).Perform(); |
| 79 | |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 80 | Trace::ReturnTrace(); |
| 81 | } |
| 82 | |
turaj@webrtc.org | 7cc64b3 | 2014-01-10 22:35:09 +0000 | [diff] [blame^] | 83 | TEST(AudioCodingModuleTest, TestIsac) { |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 84 | Trace::CreateTrace(); |
| 85 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 86 | "acm_isac_trace.txt").c_str()); |
turaj@webrtc.org | 6ea3d1c | 2013-10-02 21:44:33 +0000 | [diff] [blame] | 87 | webrtc::Config config; |
| 88 | |
| 89 | UseLegacyAcm(&config); |
| 90 | webrtc::ISACTest(ACM_TEST_MODE, config).Perform(); |
| 91 | |
| 92 | UseNewAcm(&config); |
| 93 | webrtc::ISACTest(ACM_TEST_MODE, config).Perform(); |
| 94 | |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 95 | Trace::ReturnTrace(); |
| 96 | } |
| 97 | |
turaj@webrtc.org | 7cc64b3 | 2014-01-10 22:35:09 +0000 | [diff] [blame^] | 98 | TEST(AudioCodingModuleTest, TwoWayCommunication) { |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 99 | Trace::CreateTrace(); |
| 100 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 101 | "acm_twowaycom_trace.txt").c_str()); |
turaj@webrtc.org | 6ea3d1c | 2013-10-02 21:44:33 +0000 | [diff] [blame] | 102 | webrtc::Config config; |
| 103 | |
| 104 | UseLegacyAcm(&config); |
| 105 | webrtc::TwoWayCommunication(ACM_TEST_MODE, config).Perform(); |
| 106 | |
| 107 | UseNewAcm(&config); |
| 108 | webrtc::TwoWayCommunication(ACM_TEST_MODE, config).Perform(); |
| 109 | |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 110 | Trace::ReturnTrace(); |
| 111 | } |
| 112 | |
turaj@webrtc.org | 7cc64b3 | 2014-01-10 22:35:09 +0000 | [diff] [blame^] | 113 | TEST(AudioCodingModuleTest, TestStereo) { |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 114 | Trace::CreateTrace(); |
| 115 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 116 | "acm_stereo_trace.txt").c_str()); |
turaj@webrtc.org | 6ea3d1c | 2013-10-02 21:44:33 +0000 | [diff] [blame] | 117 | |
| 118 | webrtc::Config config; |
| 119 | UseLegacyAcm(&config); |
| 120 | |
| 121 | webrtc::TestStereo(ACM_TEST_MODE, config).Perform(); |
| 122 | UseNewAcm(&config); |
| 123 | |
| 124 | webrtc::TestStereo(ACM_TEST_MODE, config).Perform(); |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 125 | Trace::ReturnTrace(); |
| 126 | } |
| 127 | |
turaj@webrtc.org | 7cc64b3 | 2014-01-10 22:35:09 +0000 | [diff] [blame^] | 128 | TEST(AudioCodingModuleTest, TestVADDTX) { |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 129 | Trace::CreateTrace(); |
| 130 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 131 | "acm_vaddtx_trace.txt").c_str()); |
turaj@webrtc.org | 6ea3d1c | 2013-10-02 21:44:33 +0000 | [diff] [blame] | 132 | webrtc::Config config; |
| 133 | |
| 134 | UseLegacyAcm(&config); |
| 135 | webrtc::TestVADDTX(config).Perform(); |
| 136 | |
| 137 | UseNewAcm(&config); |
| 138 | webrtc::TestVADDTX(config).Perform(); |
| 139 | |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 140 | Trace::ReturnTrace(); |
| 141 | } |
tina.legrand@webrtc.org | 50d5ca5 | 2012-06-18 13:35:52 +0000 | [diff] [blame] | 142 | |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 143 | TEST(AudioCodingModuleTest, TestOpus) { |
| 144 | Trace::CreateTrace(); |
| 145 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 146 | "acm_opus_trace.txt").c_str()); |
turaj@webrtc.org | 6ea3d1c | 2013-10-02 21:44:33 +0000 | [diff] [blame] | 147 | webrtc::Config config; |
| 148 | |
| 149 | UseLegacyAcm(&config); |
| 150 | webrtc::OpusTest(config).Perform(); |
| 151 | |
| 152 | UseNewAcm(&config); |
| 153 | webrtc::OpusTest(config).Perform(); |
| 154 | |
tina.legrand@webrtc.org | 73222cf | 2013-03-15 13:29:17 +0000 | [diff] [blame] | 155 | Trace::ReturnTrace(); |
| 156 | } |
| 157 | |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 158 | // The full API test is too long to run automatically on bots, but can be used |
| 159 | // for offline testing. User interaction is needed. |
| 160 | #ifdef ACM_TEST_FULL_API |
| 161 | TEST(AudioCodingModuleTest, TestAPI) { |
| 162 | Trace::CreateTrace(); |
| 163 | Trace::SetTraceFile((webrtc::test::OutputPath() + |
| 164 | "acm_apitest_trace.txt").c_str()); |
turaj@webrtc.org | 6ea3d1c | 2013-10-02 21:44:33 +0000 | [diff] [blame] | 165 | webrtc::Config config; |
| 166 | |
| 167 | UseLegacyAcm(&config); |
| 168 | webrtc::APITest(config).Perform(); |
| 169 | |
| 170 | UseNewAcm(&config); |
| 171 | webrtc::APITest(config).Perform(); |
| 172 | |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 173 | Trace::ReturnTrace(); |
tina.legrand@webrtc.org | 5e7ca60 | 2012-06-12 07:16:24 +0000 | [diff] [blame] | 174 | } |
tina.legrand@webrtc.org | ee92b66 | 2013-08-27 07:33:51 +0000 | [diff] [blame] | 175 | #endif |