andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 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 "webrtc/voice_engine/include/voe_base.h" |
| 12 | |
| 13 | #include "testing/gtest/include/gtest/gtest.h" |
pbos@webrtc.org | 956aa7e | 2013-05-21 13:52:32 +0000 | [diff] [blame] | 14 | #include "webrtc/modules/audio_processing/include/audio_processing.h" |
Jelena Marusic | 46bd31b | 2015-04-30 10:57:10 +0200 | [diff] [blame] | 15 | #include "webrtc/voice_engine/voice_engine_fixture.h" |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
| 18 | |
Jelena Marusic | 0b15445 | 2015-05-04 09:55:59 +0200 | [diff] [blame^] | 19 | class VoEBaseTest : public VoiceEngineFixture {}; |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 20 | |
Jelena Marusic | 0b15445 | 2015-05-04 09:55:59 +0200 | [diff] [blame^] | 21 | TEST_F(VoEBaseTest, InitWithExternalAudioDeviceAndAudioProcessing) { |
andrew@webrtc.org | 46323b3 | 2015-01-13 06:48:06 +0000 | [diff] [blame] | 22 | AudioProcessing* audioproc = AudioProcessing::Create(); |
Jelena Marusic | 06b08af | 2015-04-21 11:39:57 +0200 | [diff] [blame] | 23 | EXPECT_EQ(0, base_->Init(&adm_, audioproc)); |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 24 | EXPECT_EQ(audioproc, base_->audio_processing()); |
Jelena Marusic | 06b08af | 2015-04-21 11:39:57 +0200 | [diff] [blame] | 25 | EXPECT_EQ(0, base_->LastError()); |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 26 | } |
| 27 | |
Jelena Marusic | 0b15445 | 2015-05-04 09:55:59 +0200 | [diff] [blame^] | 28 | TEST_F(VoEBaseTest, InitWithExternalAudioDevice) { |
Jelena Marusic | 06b08af | 2015-04-21 11:39:57 +0200 | [diff] [blame] | 29 | EXPECT_EQ(nullptr, base_->audio_processing()); |
| 30 | EXPECT_EQ(0, base_->Init(&adm_, nullptr)); |
| 31 | EXPECT_NE(nullptr, base_->audio_processing()); |
| 32 | EXPECT_EQ(0, base_->LastError()); |
| 33 | } |
| 34 | |
Jelena Marusic | 0b15445 | 2015-05-04 09:55:59 +0200 | [diff] [blame^] | 35 | TEST_F(VoEBaseTest, CreateChannelBeforeInitShouldFail) { |
Jelena Marusic | 06b08af | 2015-04-21 11:39:57 +0200 | [diff] [blame] | 36 | int channelID = base_->CreateChannel(); |
Jelena Marusic | 46bd31b | 2015-04-30 10:57:10 +0200 | [diff] [blame] | 37 | EXPECT_EQ(channelID, -1); |
Jelena Marusic | 06b08af | 2015-04-21 11:39:57 +0200 | [diff] [blame] | 38 | } |
| 39 | |
Jelena Marusic | 0b15445 | 2015-05-04 09:55:59 +0200 | [diff] [blame^] | 40 | TEST_F(VoEBaseTest, CreateChannelAfterInit) { |
Jelena Marusic | 06b08af | 2015-04-21 11:39:57 +0200 | [diff] [blame] | 41 | EXPECT_EQ(0, base_->Init(&adm_, nullptr)); |
| 42 | int channelID = base_->CreateChannel(); |
Jelena Marusic | 46bd31b | 2015-04-30 10:57:10 +0200 | [diff] [blame] | 43 | EXPECT_NE(channelID, -1); |
Jelena Marusic | 06b08af | 2015-04-21 11:39:57 +0200 | [diff] [blame] | 44 | EXPECT_EQ(0, base_->DeleteChannel(channelID)); |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | } // namespace webrtc |