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

Side by Side Diff: media/audio/audio_manager_unittest.cc

Issue 2150983003: Fix audio_manager_unittest should update with AudioDevice display_name (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/audio_manager.h" 5 #include "media/audio/audio_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 audio_nodes.push_back(kJabraMic2); 372 audio_nodes.push_back(kJabraMic2);
373 audio_nodes.push_back(kUSBCameraMic); 373 audio_nodes.push_back(kUSBCameraMic);
374 audio_nodes.push_back(kHDMIOutput); 374 audio_nodes.push_back(kHDMIOutput);
375 audio_nodes.push_back(kJabraSpeaker1); 375 audio_nodes.push_back(kJabraSpeaker1);
376 SetUpCrasAudioHandlerWithTestingNodes(audio_nodes); 376 SetUpCrasAudioHandlerWithTestingNodes(audio_nodes);
377 377
378 ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable()); 378 ABORT_AUDIO_TEST_IF_NOT(InputDevicesAvailable());
379 379
380 // Setup expectation with physical devices. 380 // Setup expectation with physical devices.
381 std::map<uint64_t, std::string> expectation; 381 std::map<uint64_t, std::string> expectation;
382 expectation[kJabraMic1.id] = kJabraMic1.device_name; 382 expectation[kJabraMic1.id] =
383 expectation[kJabraMic2.id] = kJabraMic2.device_name; 383 cras_audio_handler_->GetDeviceFromId(kJabraMic1.id)->display_name;
384 expectation[kUSBCameraMic.id] = kUSBCameraMic.device_name; 384 expectation[kJabraMic2.id] =
385 cras_audio_handler_->GetDeviceFromId(kJabraMic2.id)->display_name;
386 expectation[kUSBCameraMic.id] =
387 cras_audio_handler_->GetDeviceFromId(kUSBCameraMic.id)->display_name;
385 388
386 DVLOG(2) << "Testing AudioManagerCras."; 389 DVLOG(2) << "Testing AudioManagerCras.";
387 CreateAudioManagerForTesting<AudioManagerCras>(); 390 CreateAudioManagerForTesting<AudioManagerCras>();
388 AudioDeviceNames device_names; 391 AudioDeviceNames device_names;
389 audio_manager_->GetAudioInputDeviceNames(&device_names); 392 audio_manager_->GetAudioInputDeviceNames(&device_names);
390 CheckDeviceNamesCras(device_names, expectation); 393 CheckDeviceNamesCras(device_names, expectation);
391 } 394 }
392 395
393 TEST_F(AudioManagerTest, EnumerateOutputDevicesCras) { 396 TEST_F(AudioManagerTest, EnumerateOutputDevicesCras) {
394 // Setup the devices without internal mic, so that it doesn't exist 397 // Setup the devices without internal mic, so that it doesn't exist
395 // beamforming capable mic. 398 // beamforming capable mic.
396 AudioNodeList audio_nodes; 399 AudioNodeList audio_nodes;
397 audio_nodes.push_back(kJabraMic1); 400 audio_nodes.push_back(kJabraMic1);
398 audio_nodes.push_back(kJabraMic2); 401 audio_nodes.push_back(kJabraMic2);
399 audio_nodes.push_back(kUSBCameraMic); 402 audio_nodes.push_back(kUSBCameraMic);
400 audio_nodes.push_back(kHDMIOutput); 403 audio_nodes.push_back(kHDMIOutput);
401 audio_nodes.push_back(kJabraSpeaker1); 404 audio_nodes.push_back(kJabraSpeaker1);
402 SetUpCrasAudioHandlerWithTestingNodes(audio_nodes); 405 SetUpCrasAudioHandlerWithTestingNodes(audio_nodes);
403 406
404 ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable()); 407 ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable());
405 408
406 // Setup expectation with physical devices. 409 // Setup expectation with physical devices.
407 std::map<uint64_t, std::string> expectation; 410 std::map<uint64_t, std::string> expectation;
408 expectation[kHDMIOutput.id] = kHDMIOutput.device_name; 411 expectation[kHDMIOutput.id] =
409 expectation[kJabraSpeaker1.id] = kJabraSpeaker1.device_name; 412 cras_audio_handler_->GetDeviceFromId(kHDMIOutput.id)->display_name;
413 expectation[kJabraSpeaker1.id] =
414 cras_audio_handler_->GetDeviceFromId(kJabraSpeaker1.id)->display_name;
410 415
411 DVLOG(2) << "Testing AudioManagerCras."; 416 DVLOG(2) << "Testing AudioManagerCras.";
412 CreateAudioManagerForTesting<AudioManagerCras>(); 417 CreateAudioManagerForTesting<AudioManagerCras>();
413 AudioDeviceNames device_names; 418 AudioDeviceNames device_names;
414 audio_manager_->GetAudioOutputDeviceNames(&device_names); 419 audio_manager_->GetAudioOutputDeviceNames(&device_names);
415 CheckDeviceNamesCras(device_names, expectation); 420 CheckDeviceNamesCras(device_names, expectation);
416 } 421 }
417 #else // !defined(USE_CRAS) 422 #else // !defined(USE_CRAS)
418 423
419 TEST_F(AudioManagerTest, HandleDefaultDeviceIDs) { 424 TEST_F(AudioManagerTest, HandleDefaultDeviceIDs) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 found_an_associated_device = true; 634 found_an_associated_device = true;
630 } 635 }
631 } 636 }
632 637
633 EXPECT_TRUE(found_an_associated_device); 638 EXPECT_TRUE(found_an_associated_device);
634 #endif // defined(OS_WIN) || defined(OS_MACOSX) 639 #endif // defined(OS_WIN) || defined(OS_MACOSX)
635 } 640 }
636 #endif // defined(USE_CRAS) 641 #endif // defined(USE_CRAS)
637 642
638 } // namespace media 643 } // namespace media
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