Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / modules / audio_coding / neteq / time_stretch_unittest.cc
1 /*
2  *  Copyright (c) 2012 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 // Unit tests for Accelerate and PreemptiveExpand classes.
12
13 #include "webrtc/modules/audio_coding/neteq/accelerate.h"
14 #include "webrtc/modules/audio_coding/neteq/preemptive_expand.h"
15
16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "webrtc/modules/audio_coding/neteq/background_noise.h"
18
19 namespace webrtc {
20
21 TEST(TimeStretch, CreateAndDestroy) {
22   const int kSampleRate = 8000;
23   const size_t kNumChannels = 1;
24   const int kOverlapSamples = 5 * kSampleRate / 8000;
25   BackgroundNoise bgn(kNumChannels);
26   Accelerate accelerate(kSampleRate, kNumChannels, bgn);
27   PreemptiveExpand preemptive_expand(
28       kSampleRate, kNumChannels, bgn, kOverlapSamples);
29 }
30
31 TEST(TimeStretch, CreateUsingFactory) {
32   const int kSampleRate = 8000;
33   const size_t kNumChannels = 1;
34   const int kOverlapSamples = 5 * kSampleRate / 8000;
35   BackgroundNoise bgn(kNumChannels);
36
37   AccelerateFactory accelerate_factory;
38   Accelerate* accelerate =
39       accelerate_factory.Create(kSampleRate, kNumChannels, bgn);
40   EXPECT_TRUE(accelerate != NULL);
41   delete accelerate;
42
43   PreemptiveExpandFactory preemptive_expand_factory;
44   PreemptiveExpand* preemptive_expand = preemptive_expand_factory.Create(
45       kSampleRate, kNumChannels, bgn, kOverlapSamples);
46   EXPECT_TRUE(preemptive_expand != NULL);
47   delete preemptive_expand;
48 }
49
50 // TODO(hlundin): Write more tests.
51
52 }  // namespace webrtc