Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(750)

Unified Diff: voice_engine/voe_base_unittest.cc

Issue 3018523002: Clean out unused methods from VoiceEngine and VoEBase. (Closed)
Patch Set: rebase Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « voice_engine/voe_base_impl.cc ('k') | voice_engine/voice_engine_defines.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: voice_engine/voe_base_unittest.cc
diff --git a/voice_engine/voe_base_unittest.cc b/voice_engine/voe_base_unittest.cc
index d6eb875fb341660e716eefec8f56643ecc2be9d7..33758789a813786b609e273671b2cf20e4267061 100644
--- a/voice_engine/voe_base_unittest.cc
+++ b/voice_engine/voe_base_unittest.cc
@@ -10,20 +10,35 @@
#include "voice_engine/include/voe_base.h"
-#include "modules/audio_processing/include/audio_processing.h"
+#include "modules/audio_device/include/fake_audio_device.h"
+#include "modules/audio_processing/include/mock_audio_processing.h"
#include "test/gtest.h"
-#include "voice_engine/channel_manager.h"
-#include "voice_engine/shared_data.h"
-#include "voice_engine/voice_engine_fixture.h"
-#include "voice_engine/voice_engine_impl.h"
namespace webrtc {
-class VoEBaseTest : public VoiceEngineFixture {};
+class VoEBaseTest : public ::testing::Test {
+ protected:
+ VoEBaseTest()
+ : voe_(VoiceEngine::Create()),
+ base_(VoEBase::GetInterface(voe_)) {
+ EXPECT_NE(nullptr, base_);
+ apm_ = new rtc::RefCountedObject<test::MockAudioProcessing>();
+ }
+
+ ~VoEBaseTest() {
+ EXPECT_EQ(0, base_->Terminate());
+ EXPECT_EQ(1, base_->Release());
+ EXPECT_TRUE(VoiceEngine::Delete(voe_));
+ }
+
+ VoiceEngine* voe_;
+ VoEBase* base_;
+ FakeAudioDeviceModule adm_;
+ rtc::scoped_refptr<AudioProcessing> apm_;
+};
TEST_F(VoEBaseTest, InitWithExternalAudioDevice) {
EXPECT_EQ(0, base_->Init(&adm_, apm_.get()));
- EXPECT_EQ(0, base_->LastError());
}
TEST_F(VoEBaseTest, CreateChannelBeforeInitShouldFail) {
@@ -38,40 +53,4 @@ TEST_F(VoEBaseTest, CreateChannelAfterInit) {
EXPECT_EQ(0, base_->DeleteChannel(channelID));
}
-TEST_F(VoEBaseTest, AssociateSendChannel) {
- EXPECT_EQ(0, base_->Init(&adm_, apm_.get()));
-
- const int channel_1 = base_->CreateChannel();
-
- // Associating with a channel that does not exist should fail.
- EXPECT_EQ(-1, base_->AssociateSendChannel(channel_1, channel_1 + 1));
-
- const int channel_2 = base_->CreateChannel();
-
- // Let the two channels associate with each other. This is not a normal use
- // case. Actually, circular association should be avoided in practice. This
- // is just to test that no crash is caused.
- EXPECT_EQ(0, base_->AssociateSendChannel(channel_1, channel_2));
- EXPECT_EQ(0, base_->AssociateSendChannel(channel_2, channel_1));
-
- voe::SharedData* shared_data = static_cast<voe::SharedData*>(
- static_cast<VoiceEngineImpl*>(voe_));
- voe::ChannelOwner reference = shared_data->channel_manager()
- .GetChannel(channel_1);
- EXPECT_EQ(0, base_->DeleteChannel(channel_1));
- // Make sure that the only use of the channel-to-delete is |reference|
- // at this point.
- EXPECT_EQ(1, reference.use_count());
-
- reference = shared_data->channel_manager().GetChannel(channel_2);
- EXPECT_EQ(0, base_->DeleteChannel(channel_2));
- EXPECT_EQ(1, reference.use_count());
-}
-
-TEST_F(VoEBaseTest, GetVersion) {
- char v1[1024] = {75};
- base_->GetVersion(v1);
- std::string v2 = VoiceEngine::GetVersionString() + "\n";
- EXPECT_EQ(v2, v1);
-}
} // namespace webrtc
« no previous file with comments | « voice_engine/voe_base_impl.cc ('k') | voice_engine/voice_engine_defines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698