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

Side by Side Diff: pc/test/fakeaudiocapturemodule_unittest.cc

Issue 3020493002: Remove AudioDeviceObserver and make ADM not inherit from the Module interface.
Patch Set: linux build error Created 3 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 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 rtc::CriticalSection crit_; 126 rtc::CriticalSection crit_;
127 127
128 int push_iterations_; 128 int push_iterations_;
129 int pull_iterations_; 129 int pull_iterations_;
130 130
131 char rec_buffer_[FakeAudioCaptureModule::kNumberSamples * 131 char rec_buffer_[FakeAudioCaptureModule::kNumberSamples *
132 FakeAudioCaptureModule::kNumberBytesPerSample]; 132 FakeAudioCaptureModule::kNumberBytesPerSample];
133 size_t rec_buffer_bytes_; 133 size_t rec_buffer_bytes_;
134 }; 134 };
135 135
136 TEST_F(FakeAdmTest, TestProcess) {
137 // Next process call must be some time in the future (or now).
138 EXPECT_LE(0, fake_audio_capture_module_->TimeUntilNextProcess());
139 // Process call updates TimeUntilNextProcess() but there are no guarantees on
140 // timing so just check that Process can be called successfully.
141 fake_audio_capture_module_->Process();
142 }
143
144 TEST_F(FakeAdmTest, PlayoutTest) { 136 TEST_F(FakeAdmTest, PlayoutTest) {
145 EXPECT_EQ(0, fake_audio_capture_module_->RegisterAudioCallback(this)); 137 EXPECT_EQ(0, fake_audio_capture_module_->RegisterAudioCallback(this));
146 138
147 bool stereo_available = false; 139 bool stereo_available = false;
148 EXPECT_EQ(0, 140 EXPECT_EQ(0,
149 fake_audio_capture_module_->StereoPlayoutIsAvailable( 141 fake_audio_capture_module_->StereoPlayoutIsAvailable(
150 &stereo_available)); 142 &stereo_available));
151 EXPECT_TRUE(stereo_available); 143 EXPECT_TRUE(stereo_available);
152 144
153 EXPECT_NE(0, fake_audio_capture_module_->StartPlayout()); 145 EXPECT_NE(0, fake_audio_capture_module_->StartPlayout());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 196
205 EXPECT_EQ(0, fake_audio_capture_module_->InitRecording()); 197 EXPECT_EQ(0, fake_audio_capture_module_->InitRecording());
206 EXPECT_EQ(0, fake_audio_capture_module_->StartRecording()); 198 EXPECT_EQ(0, fake_audio_capture_module_->StartRecording());
207 199
208 EXPECT_TRUE_WAIT(push_iterations() > 0, kMsInSecond); 200 EXPECT_TRUE_WAIT(push_iterations() > 0, kMsInSecond);
209 EXPECT_TRUE_WAIT(pull_iterations() > 0, kMsInSecond); 201 EXPECT_TRUE_WAIT(pull_iterations() > 0, kMsInSecond);
210 202
211 EXPECT_EQ(0, fake_audio_capture_module_->StopPlayout()); 203 EXPECT_EQ(0, fake_audio_capture_module_->StopPlayout());
212 EXPECT_EQ(0, fake_audio_capture_module_->StopRecording()); 204 EXPECT_EQ(0, fake_audio_capture_module_->StopRecording());
213 } 205 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698