blob: 72284ffa3e337cd24705bb38f2db974a8e9a3dac [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::AudioCodingModule;
31using webrtc::Trace;
32
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000033// This parameter is used to describe how to run the tests. It is normally
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000034// set to 0, and all tests are run in quite mode.
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000035#define ACM_TEST_MODE 0
niklase@google.com470e71d2011-07-07 08:21:25 +000036
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000037TEST(AudioCodingModuleTest, TestAllCodecs) {
38 Trace::CreateTrace();
39 Trace::SetTraceFile((webrtc::test::OutputPath() +
tina.legrand@webrtc.orgd5726a12013-05-03 07:34:12 +000040 "acm_allcodecs_trace.txt").c_str());
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000041 webrtc::TestAllCodecs(ACM_TEST_MODE).Perform();
42 Trace::ReturnTrace();
43}
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000044
45TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestEncodeDecode)) {
46 Trace::CreateTrace();
47 Trace::SetTraceFile((webrtc::test::OutputPath() +
48 "acm_encodedecode_trace.txt").c_str());
49 webrtc::EncodeDecodeTest(ACM_TEST_MODE).Perform();
50 Trace::ReturnTrace();
51}
52
53TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestFEC)) {
54 Trace::CreateTrace();
55 Trace::SetTraceFile((webrtc::test::OutputPath() +
56 "acm_fec_trace.txt").c_str());
57 webrtc::TestFEC().Perform();
58 Trace::ReturnTrace();
59}
60
61TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestIsac)) {
62 Trace::CreateTrace();
63 Trace::SetTraceFile((webrtc::test::OutputPath() +
64 "acm_isac_trace.txt").c_str());
65 webrtc::ISACTest(ACM_TEST_MODE).Perform();
66 Trace::ReturnTrace();
67}
68
69TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TwoWayCommunication)) {
70 Trace::CreateTrace();
71 Trace::SetTraceFile((webrtc::test::OutputPath() +
72 "acm_twowaycom_trace.txt").c_str());
73 webrtc::TwoWayCommunication(ACM_TEST_MODE).Perform();
74 Trace::ReturnTrace();
75}
76
77TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestStereo)) {
78 Trace::CreateTrace();
79 Trace::SetTraceFile((webrtc::test::OutputPath() +
80 "acm_stereo_trace.txt").c_str());
81 webrtc::TestStereo(ACM_TEST_MODE).Perform();
82 Trace::ReturnTrace();
83}
84
85TEST(AudioCodingModuleTest, DISABLED_ON_ANDROID(TestVADDTX)) {
86 Trace::CreateTrace();
87 Trace::SetTraceFile((webrtc::test::OutputPath() +
88 "acm_vaddtx_trace.txt").c_str());
89 webrtc::TestVADDTX().Perform();
90 Trace::ReturnTrace();
91}
tina.legrand@webrtc.org50d5ca52012-06-18 13:35:52 +000092
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000093TEST(AudioCodingModuleTest, TestOpus) {
94 Trace::CreateTrace();
95 Trace::SetTraceFile((webrtc::test::OutputPath() +
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +000096 "acm_opus_trace.txt").c_str());
tina.legrand@webrtc.org73222cf2013-03-15 13:29:17 +000097 webrtc::OpusTest().Perform();
98 Trace::ReturnTrace();
99}
100
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000101// The full API test is too long to run automatically on bots, but can be used
102// for offline testing. User interaction is needed.
103#ifdef ACM_TEST_FULL_API
104 TEST(AudioCodingModuleTest, TestAPI) {
105 Trace::CreateTrace();
106 Trace::SetTraceFile((webrtc::test::OutputPath() +
107 "acm_apitest_trace.txt").c_str());
108 webrtc::APITest().Perform();
109 Trace::ReturnTrace();
tina.legrand@webrtc.org5e7ca602012-06-12 07:16:24 +0000110 }
tina.legrand@webrtc.orgee92b662013-08-27 07:33:51 +0000111#endif