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

Side by Side Diff: webrtc/modules/audio_device/audio_device_unittest.cc

Issue 2779023002: Ensures that audio device tests works when run through remote desktop (Closed)
Patch Set: nit Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 #else 222 #else
223 requirements_satisfied_ = false; 223 requirements_satisfied_ = false;
224 #endif 224 #endif
225 if (requirements_satisfied_) { 225 if (requirements_satisfied_) {
226 EXPECT_EQ(0, audio_device_->SetPlayoutDevice(0)); 226 EXPECT_EQ(0, audio_device_->SetPlayoutDevice(0));
227 EXPECT_EQ(0, audio_device_->InitSpeaker()); 227 EXPECT_EQ(0, audio_device_->InitSpeaker());
228 EXPECT_EQ(0, audio_device_->SetRecordingDevice(0)); 228 EXPECT_EQ(0, audio_device_->SetRecordingDevice(0));
229 EXPECT_EQ(0, audio_device_->InitMicrophone()); 229 EXPECT_EQ(0, audio_device_->InitMicrophone());
230 EXPECT_EQ(0, audio_device_->StereoPlayoutIsAvailable(&stereo_playout_)); 230 EXPECT_EQ(0, audio_device_->StereoPlayoutIsAvailable(&stereo_playout_));
231 EXPECT_EQ(0, audio_device_->SetStereoPlayout(stereo_playout_)); 231 EXPECT_EQ(0, audio_device_->SetStereoPlayout(stereo_playout_));
232 EXPECT_EQ(0, 232 // Avoid asking for input stereo support and always record in mono
233 audio_device_->StereoRecordingIsAvailable(&stereo_recording_)); 233 // since asking can cause issues in combination with remote desktop.
234 EXPECT_EQ(0, audio_device_->SetStereoRecording(stereo_recording_)); 234 // See https://bugs.chromium.org/p/webrtc/issues/detail?id=7397 for
235 // details.
236 EXPECT_EQ(0, audio_device_->SetStereoRecording(false));
235 EXPECT_EQ(0, audio_device_->SetAGC(false)); 237 EXPECT_EQ(0, audio_device_->SetAGC(false));
236 EXPECT_FALSE(audio_device_->AGC()); 238 EXPECT_FALSE(audio_device_->AGC());
237 } 239 }
238 } 240 }
239 241
240 virtual ~AudioDeviceTest() { 242 virtual ~AudioDeviceTest() {
241 if (audio_device_) { 243 if (audio_device_) {
242 EXPECT_EQ(0, audio_device_->Terminate()); 244 EXPECT_EQ(0, audio_device_->Terminate());
243 } 245 }
244 } 246 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 EXPECT_EQ(0, audio_device()->StopRecording()); 278 EXPECT_EQ(0, audio_device()->StopRecording());
277 EXPECT_FALSE(audio_device()->Recording()); 279 EXPECT_FALSE(audio_device()->Recording());
278 EXPECT_FALSE(audio_device()->RecordingIsInitialized()); 280 EXPECT_FALSE(audio_device()->RecordingIsInitialized());
279 } 281 }
280 282
281 private: 283 private:
282 bool requirements_satisfied_ = true; 284 bool requirements_satisfied_ = true;
283 rtc::Event event_; 285 rtc::Event event_;
284 rtc::scoped_refptr<AudioDeviceModule> audio_device_; 286 rtc::scoped_refptr<AudioDeviceModule> audio_device_;
285 bool stereo_playout_ = false; 287 bool stereo_playout_ = false;
286 bool stereo_recording_ = false;
287 }; 288 };
288 289
289 // Uses the test fixture to create, initialize and destruct the ADM. 290 // Uses the test fixture to create, initialize and destruct the ADM.
290 TEST_F(AudioDeviceTest, ConstructDestruct) {} 291 TEST_F(AudioDeviceTest, ConstructDestruct) {}
291 292
292 TEST_F(AudioDeviceTest, InitTerminate) { 293 TEST_F(AudioDeviceTest, InitTerminate) {
293 SKIP_TEST_IF_NOT(requirements_satisfied()); 294 SKIP_TEST_IF_NOT(requirements_satisfied());
294 // Initialization is part of the test fixture. 295 // Initialization is part of the test fixture.
295 EXPECT_TRUE(audio_device()->Initialized()); 296 EXPECT_TRUE(audio_device()->Initialized());
296 EXPECT_EQ(0, audio_device()->Terminate()); 297 EXPECT_EQ(0, audio_device()->Terminate());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 .Times(AtLeast(kNumCallbacks)); 361 .Times(AtLeast(kNumCallbacks));
361 EXPECT_EQ(0, audio_device()->RegisterAudioCallback(&mock)); 362 EXPECT_EQ(0, audio_device()->RegisterAudioCallback(&mock));
362 StartPlayout(); 363 StartPlayout();
363 StartRecording(); 364 StartRecording();
364 event()->Wait(kTestTimeOutInMilliseconds); 365 event()->Wait(kTestTimeOutInMilliseconds);
365 StopRecording(); 366 StopRecording();
366 StopPlayout(); 367 StopPlayout();
367 } 368 }
368 369
369 } // namespace webrtc 370 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698