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

Side by Side Diff: webrtc/modules/audio_device/android/audio_manager_unittest.cc

Issue 2420583002: Revert of Android audio playout now supports non-call media streams (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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
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
43 AudioManager* audio_manager() const { return audio_manager_.get(); } 38 AudioManager* audio_manager() const { return audio_manager_.get(); }
44 39
45 // A valid audio layer must always be set before calling Init(), hence we 40 // A valid audio layer must always be set before calling Init(), hence we
46 // might as well make it a part of the test fixture. 41 // might as well make it a part of the test fixture.
47 void SetActiveAudioLayer() { 42 void SetActiveAudioLayer() {
48 EXPECT_EQ(0, audio_manager()->GetDelayEstimateInMilliseconds()); 43 EXPECT_EQ(0, audio_manager()->GetDelayEstimateInMilliseconds());
49 audio_manager()->SetActiveAudioLayer(AudioDeviceModule::kAndroidJavaAudio); 44 audio_manager()->SetActiveAudioLayer(AudioDeviceModule::kAndroidJavaAudio);
50 EXPECT_NE(0, audio_manager()->GetDelayEstimateInMilliseconds()); 45 EXPECT_NE(0, audio_manager()->GetDelayEstimateInMilliseconds());
51 } 46 }
52 47
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // Perform a simple sanity check of the created engine object. 100 // Perform a simple sanity check of the created engine object.
106 ValidateSLEngine(engine_object); 101 ValidateSLEngine(engine_object);
107 } 102 }
108 } 103 }
109 104
110 TEST_F(AudioManagerTest, InitClose) { 105 TEST_F(AudioManagerTest, InitClose) {
111 EXPECT_TRUE(audio_manager()->Init()); 106 EXPECT_TRUE(audio_manager()->Init());
112 EXPECT_TRUE(audio_manager()->Close()); 107 EXPECT_TRUE(audio_manager()->Close());
113 } 108 }
114 109
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
123 TEST_F(AudioManagerTest, IsAcousticEchoCancelerSupported) { 110 TEST_F(AudioManagerTest, IsAcousticEchoCancelerSupported) {
124 PRINT("%sAcoustic Echo Canceler support: %s\n", kTag, 111 PRINT("%sAcoustic Echo Canceler support: %s\n", kTag,
125 audio_manager()->IsAcousticEchoCancelerSupported() ? "Yes" : "No"); 112 audio_manager()->IsAcousticEchoCancelerSupported() ? "Yes" : "No");
126 } 113 }
127 114
128 TEST_F(AudioManagerTest, IsAutomaticGainControlSupported) { 115 TEST_F(AudioManagerTest, IsAutomaticGainControlSupported) {
129 EXPECT_FALSE(audio_manager()->IsAutomaticGainControlSupported()); 116 EXPECT_FALSE(audio_manager()->IsAutomaticGainControlSupported());
130 } 117 }
131 118
132 TEST_F(AudioManagerTest, IsNoiseSuppressorSupported) { 119 TEST_F(AudioManagerTest, IsNoiseSuppressorSupported) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 params.frames_per_10ms_buffer()); 222 params.frames_per_10ms_buffer());
236 EXPECT_EQ(kBytesPerFrame, params.GetBytesPerFrame()); 223 EXPECT_EQ(kBytesPerFrame, params.GetBytesPerFrame());
237 EXPECT_EQ(kBytesPerFrame * kFramesPerBuffer, params.GetBytesPerBuffer()); 224 EXPECT_EQ(kBytesPerFrame * kFramesPerBuffer, params.GetBytesPerBuffer());
238 EXPECT_EQ(kBytesPerFrame * kFramesPer10msBuffer, 225 EXPECT_EQ(kBytesPerFrame * kFramesPer10msBuffer,
239 params.GetBytesPer10msBuffer()); 226 params.GetBytesPer10msBuffer());
240 EXPECT_EQ(kBufferSizeInMs, params.GetBufferSizeInMilliseconds()); 227 EXPECT_EQ(kBufferSizeInMs, params.GetBufferSizeInMilliseconds());
241 } 228 }
242 229
243 } // namespace webrtc 230 } // namespace webrtc
244 231
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698