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

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

Issue 102613007: Revert 240885 "Revert 240883 "Refactor audio manager for Android..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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: trunk/src/media/audio/android/audio_android_unittest.cc
===================================================================
--- trunk/src/media/audio/android/audio_android_unittest.cc (revision 240886)
+++ trunk/src/media/audio/android/audio_android_unittest.cc (working copy)
@@ -85,6 +85,41 @@
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) {
+ VLOG(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());
+ VLOG(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;
+ }
+}
+
std::ostream& operator<<(std::ostream& os, const AudioParameters& params) {
using namespace std;
os << endl << "format: " << FormatToString(params.format()) << endl
@@ -567,6 +602,24 @@
: VLOG(0) << "Low latency output is *not* supported";
}
+// Verify input device enumeration.
+TEST_F(AudioAndroidInputTest, GetAudioInputDeviceNames) {
+ if (!audio_manager()->HasAudioInputDevices())
+ return;
+ AudioDeviceNames devices;
+ audio_manager()->GetAudioInputDeviceNames(&devices);
+ CheckDeviceNames(devices);
+}
+
+// Verify output device enumeration.
+TEST_F(AudioAndroidOutputTest, GetAudioOutputDeviceNames) {
+ if (!audio_manager()->HasAudioOutputDevices())
+ return;
+ AudioDeviceNames devices;
+ audio_manager()->GetAudioOutputDeviceNames(&devices);
+ CheckDeviceNames(devices);
+}
+
// Ensure that a default input stream can be created and closed.
TEST_P(AudioAndroidInputTest, CreateAndCloseInputStream) {
AudioParameters params = GetInputStreamParameters();
« no previous file with comments | « trunk/src/build/android/findbugs_filter/findbugs_known_bugs.txt ('k') | trunk/src/media/audio/android/audio_manager_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698