summaryrefslogtreecommitdiff
path: root/voice_engine/voe_base_unittest.cc
blob: 6057534d0458e52eb63829020c05577b65d7066d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 *  Copyright (c) 2013 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_base.h"

#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/modules/audio_device/include/fake_audio_device.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"

namespace webrtc {

class VoEBaseTest : public ::testing::Test {
 protected:
  VoEBaseTest() :
      voe_(VoiceEngine::Create()),
      base_(VoEBase::GetInterface(voe_)),
      adm_(new FakeAudioDeviceModule) {
  }

  ~VoEBaseTest() {
    base_->Release();
    VoiceEngine::Delete(voe_);
  }

  VoiceEngine* voe_;
  VoEBase* base_;
  scoped_ptr<FakeAudioDeviceModule> adm_;
};

TEST_F(VoEBaseTest, AcceptsAudioProcessingPtr) {
  AudioProcessing* audioproc = AudioProcessing::Create(0);
  EXPECT_EQ(0, base_->Init(adm_.get(), audioproc));
  EXPECT_EQ(audioproc, base_->audio_processing());
}

TEST_F(VoEBaseTest, AudioProcessingCreatedAfterInit) {
  EXPECT_TRUE(base_->audio_processing() == NULL);
  EXPECT_EQ(0, base_->Init(adm_.get(), NULL));
  EXPECT_TRUE(base_->audio_processing() != NULL);
}

}  // namespace webrtc