blob: a89c9cd4041bcbc64790b130dcd83b84a65d4af6 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
tina.legrand@webrtc.org16b6b902012-04-12 11:02:38 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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.org5490c712011-12-21 13:34:18 +000012#include <string>
niklase@google.com470e71d2011-07-07 08:21:25 +000013#include <vector>
14
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000015#include "testing/gtest/include/gtest/gtest.h"
16#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
17#include "webrtc/modules/audio_coding/main/test/APITest.h"
18#include "webrtc/modules/audio_coding/main/test/EncodeDecodeTest.h"
19#include "webrtc/modules/audio_coding/main/test/iSACTest.h"
20#include "webrtc/modules/audio_coding/main/test/opus_test.h"
21#include "webrtc/modules/audio_coding/main/test/TestAllCodecs.h"
22#include "webrtc/modules/audio_coding/main/test/TestFEC.h"
23#include "webrtc/modules/audio_coding/main/test/TestStereo.h"
24#include "webrtc/modules/audio_coding/main/test/TestVADDTX.h"
25#include "webrtc/modules/audio_coding/main/test/TwoWayCommunication.h"
26#include "webrtc/system_wrappers/interface/trace.h"
27#include "webrtc/test/testsupport/fileutils.h"
henrike@webrtc.org89c67402013-08-02 16:53:47 +000028#include "webrtc/test/testsupport/gtest_disable.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000029
tina.legrand@webrtc.org554ae1a2011-12-16 10:09:04 +000030using webrtc::Trace;
31
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000032// This parameter is used to describe how to run the tests. It is normally
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000033// set to 0, and all tests are run in quite mode.
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000034#define ACM_TEST_MODE 0
niklase@google.com470e71d2011-07-07 08:21:25 +000035
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000036TEST(AudioCodingModuleTest, TestAllCodecs) {
37 Trace::CreateTrace();
38 Trace::SetTraceFile((webrtc::test::OutputPath() +
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000039 "acm_allcodecs_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000040 webrtc::TestAllCodecs(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000041 Trace::ReturnTrace();
42}
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000043
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +000044TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestEncodeDecode)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000045 Trace::CreateTrace();
46 Trace::SetTraceFile((webrtc::test::OutputPath() +
47 "acm_encodedecode_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000048 webrtc::EncodeDecodeTest(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000049 Trace::ReturnTrace();
50}
51
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +000052TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestFEC)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000053 Trace::CreateTrace();
54 Trace::SetTraceFile((webrtc::test::OutputPath() +
55 "acm_fec_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000056 webrtc::TestFEC().Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000057 Trace::ReturnTrace();
58}
59
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +000060TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestIsac)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000061 Trace::CreateTrace();
62 Trace::SetTraceFile((webrtc::test::OutputPath() +
63 "acm_isac_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000064 webrtc::ISACTest(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000065 Trace::ReturnTrace();
66}
67
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +000068TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TwoWayCommunication)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000069 Trace::CreateTrace();
70 Trace::SetTraceFile((webrtc::test::OutputPath() +
71 "acm_twowaycom_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000072 webrtc::TwoWayCommunication(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000073 Trace::ReturnTrace();
74}
75
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +000076TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestStereo)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000077 Trace::CreateTrace();
78 Trace::SetTraceFile((webrtc::test::OutputPath() +
79 "acm_stereo_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000080 webrtc::TestStereo(ACM_TEST_MODE).Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000081 Trace::ReturnTrace();
82}
83
andresp@webrtc.orgd0b436a2014-01-13 13:15:59 +000084TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestVADDTX)) {
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000085 Trace::CreateTrace();
86 Trace::SetTraceFile((webrtc::test::OutputPath() +
87 "acm_vaddtx_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000088 webrtc::TestVADDTX().Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000089 Trace::ReturnTrace();
90}
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000091
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000092TEST(AudioCodingModuleTest, TestOpus) {
93 Trace::CreateTrace();
94 Trace::SetTraceFile((webrtc::test::OutputPath() +
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000095 "acm_opus_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +000096 webrtc::OpusTest().Perform();
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000097 Trace::ReturnTrace();
98}
99
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000100// The full API test is too long to run automatically on bots, but can be used
101// for offline testing. User interaction is needed.
102#ifdef ACM_TEST_FULL_API
103 TEST(AudioCodingModuleTest, TestAPI) {
104 Trace::CreateTrace();
105 Trace::SetTraceFile((webrtc::test::OutputPath() +
106 "acm_apitest_trace.txt").c_str());
henrik.lundin@webrtc.orgadaf8092014-04-17 08:29:10 +0000107 webrtc::APITest().Perform();
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000108 Trace::ReturnTrace();
tina.legrand@webrtc.org5e7ca602012-06-12 07:16:24 +0000109 }
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000110#endif