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

Unified Diff: chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc

Issue 2563653002: Replace AudioManager::GetAudio*DeviceNames with AudioManager::GetAudio*DeviceDescriptions (Closed)
Patch Set: nit fixes Created 4 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: chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc
diff --git a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc
index 2463eb8f6e83672011839f6503a0ffce07f8e0ed..8b7a5452910c5f0c412ed15157467fe28dff20af 100644
--- a/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc
+++ b/chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_browsertest.cc
@@ -43,7 +43,7 @@
using base::JSONWriter;
using content::RenderProcessHost;
using content::WebContents;
-using media::AudioDeviceNames;
+using media::AudioDeviceDescriptions;
using media::AudioManager;
namespace extensions {
@@ -129,22 +129,22 @@ class WebrtcAudioPrivateTest : public AudioWaitingExtensionTest {
// Synchronously (from the calling thread's point of view) runs the
// given enumeration function on the device thread. On return,
- // |device_names| has been filled with the device names resulting
- // from that call.
- void GetAudioDeviceNames(
- void (AudioManager::*EnumerationFunc)(AudioDeviceNames*),
- AudioDeviceNames* device_names) {
+ // |device_descriptions| has been filled with the device descriptions
+ // resulting from that call.
+ void GetAudioDeviceDescriptions(
+ void (AudioManager::*EnumerationFunc)(AudioDeviceDescriptions*),
+ AudioDeviceDescriptions* device_descriptions) {
AudioManager* audio_manager = AudioManager::Get();
if (!audio_manager->GetTaskRunner()->BelongsToCurrentThread()) {
audio_manager->GetTaskRunner()->PostTask(
FROM_HERE,
- base::Bind(&WebrtcAudioPrivateTest::GetAudioDeviceNames,
- base::Unretained(this),
- EnumerationFunc, device_names));
+ base::Bind(&WebrtcAudioPrivateTest::GetAudioDeviceDescriptions,
+ base::Unretained(this), EnumerationFunc,
+ device_descriptions));
enumeration_event_.Wait();
} else {
- (audio_manager->*EnumerationFunc)(device_names);
+ (audio_manager->*EnumerationFunc)(device_descriptions);
enumeration_event_.Signal();
}
}
@@ -181,8 +181,9 @@ class WebrtcAudioPrivateTest : public AudioWaitingExtensionTest {
#if !defined(OS_MACOSX)
// http://crbug.com/334579
IN_PROC_BROWSER_TEST_F(WebrtcAudioPrivateTest, GetSinks) {
- AudioDeviceNames devices;
- GetAudioDeviceNames(&AudioManager::GetAudioOutputDeviceNames, &devices);
+ AudioDeviceDescriptions devices;
+ GetAudioDeviceDescriptions(&AudioManager::GetAudioOutputDeviceDescriptions,
+ &devices);
base::ListValue* sink_list = NULL;
std::unique_ptr<base::Value> result = InvokeGetSinks(&sink_list);
@@ -196,7 +197,7 @@ IN_PROC_BROWSER_TEST_F(WebrtcAudioPrivateTest, GetSinks) {
// Iterate through both lists in lockstep and compare. The order
// should be identical.
size_t ix = 0;
- AudioDeviceNames::const_iterator it = devices.begin();
+ AudioDeviceDescriptions::const_iterator it = devices.begin();
for (; ix < sink_list->GetSize() && it != devices.end();
++ix, ++it) {
base::DictionaryValue* dict = NULL;
@@ -332,18 +333,17 @@ IN_PROC_BROWSER_TEST_F(WebrtcAudioPrivateTest, GetAssociatedSink) {
// Get the list of input devices. We can cheat in the unit test and
// run this on the main thread since nobody else will be running at
// the same time.
- AudioDeviceNames devices;
- GetAudioDeviceNames(&AudioManager::GetAudioInputDeviceNames, &devices);
+ AudioDeviceDescriptions devices;
+ GetAudioDeviceDescriptions(&AudioManager::GetAudioInputDeviceDescriptions,
+ &devices);
// Try to get an associated sink for each source.
- for (AudioDeviceNames::const_iterator device = devices.begin();
- device != devices.end();
- ++device) {
+ for (const auto& device : devices) {
scoped_refptr<WebrtcAudioPrivateGetAssociatedSinkFunction> function =
new WebrtcAudioPrivateGetAssociatedSinkFunction();
function->set_source_url(source_url_);
- std::string raw_device_id = device->unique_id;
+ std::string raw_device_id = device.unique_id;
VLOG(2) << "Trying to find associated sink for device " << raw_device_id;
std::string source_id_in_origin;
GURL origin(GURL("http://www.google.com/").GetOrigin());

Powered by Google App Engine
This is Rietveld 408576698