| OLD | NEW |
| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/environment.h" | 6 #include "base/environment.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "media/audio/audio_manager.h" | 10 #include "media/audio/audio_manager.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 #endif | 74 #endif |
| 75 | 75 |
| 76 // Helper method which verifies that the device list starts with a valid | 76 // Helper method which verifies that the device list starts with a valid |
| 77 // default record followed by non-default device names. | 77 // default record followed by non-default device names. |
| 78 static void CheckDeviceNames(const AudioDeviceNames& device_names) { | 78 static void CheckDeviceNames(const AudioDeviceNames& device_names) { |
| 79 DVLOG(2) << "Got " << device_names.size() << " audio devices."; | 79 DVLOG(2) << "Got " << device_names.size() << " audio devices."; |
| 80 if (!device_names.empty()) { | 80 if (!device_names.empty()) { |
| 81 AudioDeviceNames::const_iterator it = device_names.begin(); | 81 AudioDeviceNames::const_iterator it = device_names.begin(); |
| 82 | 82 |
| 83 // The first device in the list should always be the default device. | 83 // The first device in the list should always be the default device. |
| 84 EXPECT_EQ(std::string(AudioManagerBase::kDefaultDeviceName), | 84 EXPECT_EQ(AudioManager::GetDefaultDeviceName(), it->device_name); |
| 85 it->device_name); | |
| 86 EXPECT_EQ(std::string(AudioManagerBase::kDefaultDeviceId), it->unique_id); | 85 EXPECT_EQ(std::string(AudioManagerBase::kDefaultDeviceId), it->unique_id); |
| 87 ++it; | 86 ++it; |
| 88 | 87 |
| 89 // Other devices should have non-empty name and id and should not contain | 88 // Other devices should have non-empty name and id and should not contain |
| 90 // default name or id. | 89 // default name or id. |
| 91 while (it != device_names.end()) { | 90 while (it != device_names.end()) { |
| 92 EXPECT_FALSE(it->device_name.empty()); | 91 EXPECT_FALSE(it->device_name.empty()); |
| 93 EXPECT_FALSE(it->unique_id.empty()); | 92 EXPECT_FALSE(it->unique_id.empty()); |
| 94 DVLOG(2) << "Device ID(" << it->unique_id | 93 DVLOG(2) << "Device ID(" << it->unique_id |
| 95 << "), label: " << it->device_name; | 94 << "), label: " << it->device_name; |
| 96 EXPECT_NE(std::string(AudioManagerBase::kDefaultDeviceName), | 95 EXPECT_NE(AudioManager::GetDefaultDeviceName(), it->device_name); |
| 97 it->device_name); | |
| 98 EXPECT_NE(std::string(AudioManagerBase::kDefaultDeviceId), | 96 EXPECT_NE(std::string(AudioManagerBase::kDefaultDeviceId), |
| 99 it->unique_id); | 97 it->unique_id); |
| 100 ++it; | 98 ++it; |
| 101 } | 99 } |
| 102 } else { | 100 } else { |
| 103 // Log a warning so we can see the status on the build bots. No need to | 101 // Log a warning so we can see the status on the build bots. No need to |
| 104 // break the test though since this does successfully test the code and | 102 // break the test though since this does successfully test the code and |
| 105 // some failure cases. | 103 // some failure cases. |
| 106 LOG(WARNING) << "No input devices detected"; | 104 LOG(WARNING) << "No input devices detected"; |
| 107 } | 105 } |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 DVLOG(2) << it->unique_id << " matches with " << output_device_id; | 359 DVLOG(2) << it->unique_id << " matches with " << output_device_id; |
| 362 found_an_associated_device = true; | 360 found_an_associated_device = true; |
| 363 } | 361 } |
| 364 } | 362 } |
| 365 | 363 |
| 366 EXPECT_TRUE(found_an_associated_device); | 364 EXPECT_TRUE(found_an_associated_device); |
| 367 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 365 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 368 } | 366 } |
| 369 | 367 |
| 370 } // namespace media | 368 } // namespace media |
| OLD | NEW |