OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 AudioManagerTest() { | 28 AudioManagerTest() { |
29 // One-time initialization of JVM and application context. Ensures that we | 29 // One-time initialization of JVM and application context. Ensures that we |
30 // can do calls between C++ and Java. | 30 // can do calls between C++ and Java. |
31 webrtc::audiodevicemodule::EnsureInitialized(); | 31 webrtc::audiodevicemodule::EnsureInitialized(); |
32 audio_manager_.reset(new AudioManager()); | 32 audio_manager_.reset(new AudioManager()); |
33 SetActiveAudioLayer(); | 33 SetActiveAudioLayer(); |
34 playout_parameters_ = audio_manager()->GetPlayoutAudioParameters(); | 34 playout_parameters_ = audio_manager()->GetPlayoutAudioParameters(); |
35 record_parameters_ = audio_manager()->GetRecordAudioParameters(); | 35 record_parameters_ = audio_manager()->GetRecordAudioParameters(); |
36 } | 36 } |
37 | 37 |
| 38 virtual ~AudioManagerTest() { |
| 39 // Always ensure that we restore default/normal mode after the test. |
| 40 audio_manager()->SetCommunicationMode(false); |
| 41 } |
| 42 |
38 AudioManager* audio_manager() const { return audio_manager_.get(); } | 43 AudioManager* audio_manager() const { return audio_manager_.get(); } |
39 | 44 |
40 // A valid audio layer must always be set before calling Init(), hence we | 45 // A valid audio layer must always be set before calling Init(), hence we |
41 // might as well make it a part of the test fixture. | 46 // might as well make it a part of the test fixture. |
42 void SetActiveAudioLayer() { | 47 void SetActiveAudioLayer() { |
43 EXPECT_EQ(0, audio_manager()->GetDelayEstimateInMilliseconds()); | 48 EXPECT_EQ(0, audio_manager()->GetDelayEstimateInMilliseconds()); |
44 audio_manager()->SetActiveAudioLayer(AudioDeviceModule::kAndroidJavaAudio); | 49 audio_manager()->SetActiveAudioLayer(AudioDeviceModule::kAndroidJavaAudio); |
45 EXPECT_NE(0, audio_manager()->GetDelayEstimateInMilliseconds()); | 50 EXPECT_NE(0, audio_manager()->GetDelayEstimateInMilliseconds()); |
46 } | 51 } |
47 | 52 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // Perform a simple sanity check of the created engine object. | 105 // Perform a simple sanity check of the created engine object. |
101 ValidateSLEngine(engine_object); | 106 ValidateSLEngine(engine_object); |
102 } | 107 } |
103 } | 108 } |
104 | 109 |
105 TEST_F(AudioManagerTest, InitClose) { | 110 TEST_F(AudioManagerTest, InitClose) { |
106 EXPECT_TRUE(audio_manager()->Init()); | 111 EXPECT_TRUE(audio_manager()->Init()); |
107 EXPECT_TRUE(audio_manager()->Close()); | 112 EXPECT_TRUE(audio_manager()->Close()); |
108 } | 113 } |
109 | 114 |
| 115 // Verify communication mode functionality. |
| 116 TEST_F(AudioManagerTest, CommunicationMode) { |
| 117 audio_manager()->SetCommunicationMode(true); |
| 118 EXPECT_TRUE(audio_manager()->IsCommunicationModeEnabled()); |
| 119 audio_manager()->SetCommunicationMode(false); |
| 120 EXPECT_FALSE(audio_manager()->IsCommunicationModeEnabled()); |
| 121 } |
| 122 |
110 TEST_F(AudioManagerTest, IsAcousticEchoCancelerSupported) { | 123 TEST_F(AudioManagerTest, IsAcousticEchoCancelerSupported) { |
111 PRINT("%sAcoustic Echo Canceler support: %s\n", kTag, | 124 PRINT("%sAcoustic Echo Canceler support: %s\n", kTag, |
112 audio_manager()->IsAcousticEchoCancelerSupported() ? "Yes" : "No"); | 125 audio_manager()->IsAcousticEchoCancelerSupported() ? "Yes" : "No"); |
113 } | 126 } |
114 | 127 |
115 TEST_F(AudioManagerTest, IsAutomaticGainControlSupported) { | 128 TEST_F(AudioManagerTest, IsAutomaticGainControlSupported) { |
116 EXPECT_FALSE(audio_manager()->IsAutomaticGainControlSupported()); | 129 EXPECT_FALSE(audio_manager()->IsAutomaticGainControlSupported()); |
117 } | 130 } |
118 | 131 |
119 TEST_F(AudioManagerTest, IsNoiseSuppressorSupported) { | 132 TEST_F(AudioManagerTest, IsNoiseSuppressorSupported) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 params.frames_per_10ms_buffer()); | 235 params.frames_per_10ms_buffer()); |
223 EXPECT_EQ(kBytesPerFrame, params.GetBytesPerFrame()); | 236 EXPECT_EQ(kBytesPerFrame, params.GetBytesPerFrame()); |
224 EXPECT_EQ(kBytesPerFrame * kFramesPerBuffer, params.GetBytesPerBuffer()); | 237 EXPECT_EQ(kBytesPerFrame * kFramesPerBuffer, params.GetBytesPerBuffer()); |
225 EXPECT_EQ(kBytesPerFrame * kFramesPer10msBuffer, | 238 EXPECT_EQ(kBytesPerFrame * kFramesPer10msBuffer, |
226 params.GetBytesPer10msBuffer()); | 239 params.GetBytesPer10msBuffer()); |
227 EXPECT_EQ(kBufferSizeInMs, params.GetBufferSizeInMilliseconds()); | 240 EXPECT_EQ(kBufferSizeInMs, params.GetBufferSizeInMilliseconds()); |
228 } | 241 } |
229 | 242 |
230 } // namespace webrtc | 243 } // namespace webrtc |
231 | 244 |
OLD | NEW |