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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 EXPECT_TRUE(audio_state->typing_noise_detected()); | 76 EXPECT_TRUE(audio_state->typing_noise_detected()); |
77 voe_observer->CallbackOnError(-1, VE_NOT_INITED); | 77 voe_observer->CallbackOnError(-1, VE_NOT_INITED); |
78 EXPECT_TRUE(audio_state->typing_noise_detected()); | 78 EXPECT_TRUE(audio_state->typing_noise_detected()); |
79 | 79 |
80 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); | 80 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); |
81 EXPECT_FALSE(audio_state->typing_noise_detected()); | 81 EXPECT_FALSE(audio_state->typing_noise_detected()); |
82 voe_observer->CallbackOnError(-1, VE_NOT_INITED); | 82 voe_observer->CallbackOnError(-1, VE_NOT_INITED); |
83 EXPECT_FALSE(audio_state->typing_noise_detected()); | 83 EXPECT_FALSE(audio_state->typing_noise_detected()); |
84 } | 84 } |
85 | 85 |
86 // Test that RecordedDataIsAvailable calls get to the original transport. | |
87 TEST(AudioStateTest, RecordedAudioArrivesAtOriginalTransport) { | |
88 using testing::_; | |
89 | 86 |
90 ConfigHelper helper; | |
91 auto& voice_engine = helper.voice_engine(); | |
92 auto device = | |
93 static_cast<MockAudioDeviceModule*>(voice_engine.audio_device_module()); | |
94 | |
95 AudioTransport* audio_transport_proxy = nullptr; | |
96 ON_CALL(*device, RegisterAudioCallback(_)) | |
97 .WillByDefault( | |
98 testing::Invoke([&audio_transport_proxy](AudioTransport* transport) { | |
99 audio_transport_proxy = transport; | |
100 return 0; | |
101 })); | |
102 | |
103 MockAudioTransport original_audio_transport; | |
104 ON_CALL(voice_engine, audio_transport()) | |
105 .WillByDefault(testing::Return(&original_audio_transport)); | |
106 | |
107 EXPECT_CALL(voice_engine, audio_device_module()); | |
108 std::unique_ptr<internal::AudioState> audio_state( | |
109 new internal::AudioState(helper.config())); | |
110 | |
111 // Setup completed. Ensure call of old transport is forwarded to new. | |
112 uint32_t new_mic_level; | |
113 EXPECT_CALL(original_audio_transport, | |
114 RecordedDataIsAvailable(nullptr, 80, 2, 1, 8000, 0, 0, 0, false, | |
115 testing::Ref(new_mic_level))); | |
116 | |
117 audio_transport_proxy->RecordedDataIsAvailable(nullptr, 80, 2, 1, 8000, 0, 0, | |
118 0, false, new_mic_level); | |
119 } | |
120 } // namespace test | 87 } // namespace test |
121 } // namespace webrtc | 88 } // namespace webrtc |
OLD | NEW |