Files
platform-external-webrtc/webrtc/voice_engine/voe_audio_processing_unittest.cc
Jelena Marusic 0d266054ac VoE: apply new style guide on VoE interfaces and their implementations
Changes:
1. Ran clang-format on VoE interfaces and their implementations.
2. Replaced virtual with override in derived classes.

R=henrika@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/49239004

Cr-Commit-Position: refs/heads/master@{#9130}
2015-05-04 12:15:41 +00:00

67 lines
2.2 KiB
C++

/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/voice_engine/include/voe_audio_processing.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/voice_engine/include/voe_base.h"
namespace webrtc {
namespace voe {
namespace {
class VoEAudioProcessingTest : public ::testing::Test {
protected:
VoEAudioProcessingTest()
: voe_(VoiceEngine::Create()),
base_(VoEBase::GetInterface(voe_)),
audioproc_(VoEAudioProcessing::GetInterface(voe_)) {}
virtual ~VoEAudioProcessingTest() {
base_->Terminate();
audioproc_->Release();
base_->Release();
VoiceEngine::Delete(voe_);
}
VoiceEngine* voe_;
VoEBase* base_;
VoEAudioProcessing* audioproc_;
};
TEST_F(VoEAudioProcessingTest, FailureIfNotInitialized) {
EXPECT_EQ(-1, audioproc_->EnableDriftCompensation(true));
EXPECT_EQ(-1, audioproc_->EnableDriftCompensation(false));
EXPECT_FALSE(audioproc_->DriftCompensationEnabled());
}
// TODO(andrew): Investigate race conditions triggered by this test:
// https://code.google.com/p/webrtc/issues/detail?id=788
TEST_F(VoEAudioProcessingTest, DISABLED_DriftCompensationIsEnabledIfSupported) {
ASSERT_EQ(0, base_->Init());
// TODO(andrew): Ideally, DriftCompensationSupported() would be mocked.
bool supported = VoEAudioProcessing::DriftCompensationSupported();
if (supported) {
EXPECT_EQ(0, audioproc_->EnableDriftCompensation(true));
EXPECT_TRUE(audioproc_->DriftCompensationEnabled());
EXPECT_EQ(0, audioproc_->EnableDriftCompensation(false));
EXPECT_FALSE(audioproc_->DriftCompensationEnabled());
} else {
EXPECT_EQ(-1, audioproc_->EnableDriftCompensation(true));
EXPECT_FALSE(audioproc_->DriftCompensationEnabled());
EXPECT_EQ(-1, audioproc_->EnableDriftCompensation(false));
EXPECT_FALSE(audioproc_->DriftCompensationEnabled());
}
}
} // namespace
} // namespace voe
} // namespace webrtc