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

Side by Side Diff: webrtc/audio/audio_state_unittest.cc

Issue 2377023002: Now pass ADM as a constructor argument to audio_state. (Closed)
Patch Set: Removed audio_transport() mock calls in tests. 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 21 matching lines...) Expand all
32 32
33 private: 33 private:
34 testing::StrictMock<MockVoiceEngine> voice_engine_; 34 testing::StrictMock<MockVoiceEngine> voice_engine_;
35 AudioState::Config config_; 35 AudioState::Config config_;
36 }; 36 };
37 } // namespace 37 } // namespace
38 38
39 TEST(AudioStateTest, Create) { 39 TEST(AudioStateTest, Create) {
40 ConfigHelper helper; 40 ConfigHelper helper;
41 rtc::scoped_refptr<AudioState> audio_state = 41 rtc::scoped_refptr<AudioState> audio_state =
42 AudioState::Create(helper.config()); 42 AudioState::Create(helper.config(), nullptr);
43 EXPECT_TRUE(audio_state.get()); 43 EXPECT_TRUE(audio_state.get());
44 } 44 }
45 45
46 TEST(AudioStateTest, ConstructDestruct) { 46 TEST(AudioStateTest, ConstructDestruct) {
47 ConfigHelper helper; 47 ConfigHelper helper;
48 std::unique_ptr<internal::AudioState> audio_state( 48 std::unique_ptr<internal::AudioState> audio_state(
49 new internal::AudioState(helper.config())); 49 new internal::AudioState(helper.config(), nullptr));
50 } 50 }
51 51
52 TEST(AudioStateTest, GetVoiceEngine) { 52 TEST(AudioStateTest, GetVoiceEngine) {
53 ConfigHelper helper; 53 ConfigHelper helper;
54 std::unique_ptr<internal::AudioState> audio_state( 54 std::unique_ptr<internal::AudioState> audio_state(
55 new internal::AudioState(helper.config())); 55 new internal::AudioState(helper.config(), nullptr));
56 EXPECT_EQ(audio_state->voice_engine(), &helper.voice_engine()); 56 EXPECT_EQ(audio_state->voice_engine(), &helper.voice_engine());
57 } 57 }
58 58
59 TEST(AudioStateTest, TypingNoiseDetected) { 59 TEST(AudioStateTest, TypingNoiseDetected) {
60 ConfigHelper helper; 60 ConfigHelper helper;
61 std::unique_ptr<internal::AudioState> audio_state( 61 std::unique_ptr<internal::AudioState> audio_state(
62 new internal::AudioState(helper.config())); 62 new internal::AudioState(helper.config(), nullptr));
63 VoiceEngineObserver* voe_observer = 63 VoiceEngineObserver* voe_observer =
64 static_cast<VoiceEngineObserver*>(audio_state.get()); 64 static_cast<VoiceEngineObserver*>(audio_state.get());
65 EXPECT_FALSE(audio_state->typing_noise_detected()); 65 EXPECT_FALSE(audio_state->typing_noise_detected());
66 66
67 voe_observer->CallbackOnError(-1, VE_NOT_INITED); 67 voe_observer->CallbackOnError(-1, VE_NOT_INITED);
68 EXPECT_FALSE(audio_state->typing_noise_detected()); 68 EXPECT_FALSE(audio_state->typing_noise_detected());
69 69
70 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); 70 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING);
71 EXPECT_TRUE(audio_state->typing_noise_detected()); 71 EXPECT_TRUE(audio_state->typing_noise_detected());
72 voe_observer->CallbackOnError(-1, VE_NOT_INITED); 72 voe_observer->CallbackOnError(-1, VE_NOT_INITED);
73 EXPECT_TRUE(audio_state->typing_noise_detected()); 73 EXPECT_TRUE(audio_state->typing_noise_detected());
74 74
75 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); 75 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING);
76 EXPECT_FALSE(audio_state->typing_noise_detected()); 76 EXPECT_FALSE(audio_state->typing_noise_detected());
77 voe_observer->CallbackOnError(-1, VE_NOT_INITED); 77 voe_observer->CallbackOnError(-1, VE_NOT_INITED);
78 EXPECT_FALSE(audio_state->typing_noise_detected()); 78 EXPECT_FALSE(audio_state->typing_noise_detected());
79 } 79 }
80 } // namespace test 80 } // namespace test
81 } // namespace webrtc 81 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698