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

Unified Diff: media/audio/android/audio_android_unittest.cc

Issue 1339183002: Add localized default audio device names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix descriptions. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/android/audio_android_unittest.cc
diff --git a/media/audio/android/audio_android_unittest.cc b/media/audio/android/audio_android_unittest.cc
index 38269bc35d9529404d4b008478c42875a2c414e6..4b04f98c488a39d3f5e1cfc9ee2dace55ea2d0fe 100644
--- a/media/audio/android/audio_android_unittest.cc
+++ b/media/audio/android/audio_android_unittest.cc
@@ -87,41 +87,6 @@ static double ExpectedTimeBetweenCallbacks(AudioParameters params) {
static_cast<double>(params.sample_rate()))).InMillisecondsF();
}
-// Helper method which verifies that the device list starts with a valid
-// default device name followed by non-default device names.
-static void CheckDeviceNames(const AudioDeviceNames& device_names) {
- DVLOG(2) << "Got " << device_names.size() << " audio devices.";
- if (device_names.empty()) {
- // Log a warning so we can see the status on the build bots. No need to
- // break the test though since this does successfully test the code and
- // some failure cases.
- LOG(WARNING) << "No input devices detected";
- return;
- }
-
- AudioDeviceNames::const_iterator it = device_names.begin();
-
- // The first device in the list should always be the default device.
- EXPECT_EQ(std::string(AudioManagerBase::kDefaultDeviceName),
- it->device_name);
- EXPECT_EQ(std::string(AudioManagerBase::kDefaultDeviceId), it->unique_id);
- ++it;
-
- // Other devices should have non-empty name and id and should not contain
- // default name or id.
- while (it != device_names.end()) {
- EXPECT_FALSE(it->device_name.empty());
- EXPECT_FALSE(it->unique_id.empty());
- DVLOG(2) << "Device ID(" << it->unique_id
- << "), label: " << it->device_name;
- EXPECT_NE(std::string(AudioManagerBase::kDefaultDeviceName),
- it->device_name);
- EXPECT_NE(std::string(AudioManagerBase::kDefaultDeviceId),
- it->unique_id);
- ++it;
- }
-}
-
// We clear the data bus to ensure that the test does not cause noise.
static int RealOnMoreData(AudioBus* dest, uint32 total_bytes_delay) {
dest->Zero();
@@ -552,6 +517,38 @@ class AudioAndroidOutputTest : public testing::Test {
audio_output_stream_ = NULL;
}
+ // Helper method which verifies that the device list starts with a valid
+ // default device name followed by non-default device names.
+ void CheckDeviceNames(const AudioDeviceNames& device_names) {
+ DVLOG(2) << "Got " << device_names.size() << " audio devices.";
+ if (device_names.empty()) {
+ // Log a warning so we can see the status on the build bots. No need to
+ // break the test though since this does successfully test the code and
+ // some failure cases.
+ LOG(WARNING) << "No input devices detected";
+ return;
+ }
+
+ AudioDeviceNames::const_iterator it = device_names.begin();
+
+ // The first device in the list should always be the default device.
+ EXPECT_EQ(audio_manager()->GetDefaultDeviceName(), it->device_name);
+ EXPECT_EQ(std::string(AudioManagerBase::kDefaultDeviceId), it->unique_id);
+ ++it;
+
+ // Other devices should have non-empty name and id and should not contain
+ // default name or id.
+ while (it != device_names.end()) {
+ EXPECT_FALSE(it->device_name.empty());
+ EXPECT_FALSE(it->unique_id.empty());
+ DVLOG(2) << "Device ID(" << it->unique_id
+ << "), label: " << it->device_name;
+ EXPECT_NE(audio_manager()->GetDefaultDeviceName(), it->device_name);
+ EXPECT_NE(std::string(AudioManagerBase::kDefaultDeviceId), it->unique_id);
+ ++it;
+ }
+ }
+
scoped_ptr<base::MessageLoopForUI> loop_;
scoped_ptr<AudioManager> audio_manager_;
AudioParameters audio_output_parameters_;

Powered by Google App Engine
This is Rietveld 408576698