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

Unified Diff: media/audio/win/core_audio_util_win_unittest.cc

Issue 2824773002: Rename ScopedComPtr::get() to ScopedComPtr::Get() (Closed)
Patch Set: Update to 5293966 Created 3 years, 8 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
« no previous file with comments | « media/audio/win/core_audio_util_win.cc ('k') | media/base/win/mf_helpers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/win/core_audio_util_win_unittest.cc
diff --git a/media/audio/win/core_audio_util_win_unittest.cc b/media/audio/win/core_audio_util_win_unittest.cc
index 03c6e4f2b94d294a038a8deca90d0ec7279a018c..6a13f2649613ffe40a9514dab79a14b651f54f7d 100644
--- a/media/audio/win/core_audio_util_win_unittest.cc
+++ b/media/audio/win/core_audio_util_win_unittest.cc
@@ -65,7 +65,7 @@ TEST_F(CoreAudioUtilWinTest, CreateDeviceEnumerator) {
ScopedComPtr<IMMDeviceEnumerator> enumerator =
CoreAudioUtil::CreateDeviceEnumerator();
- EXPECT_TRUE(enumerator.get());
+ EXPECT_TRUE(enumerator.Get());
}
TEST_F(CoreAudioUtilWinTest, CreateDefaultDevice) {
@@ -88,13 +88,13 @@ TEST_F(CoreAudioUtilWinTest, CreateDefaultDevice) {
for (size_t i = 0; i < arraysize(data); ++i) {
audio_device =
CoreAudioUtil::CreateDefaultDevice(data[i].flow, data[i].role);
- EXPECT_TRUE(audio_device.get());
- EXPECT_EQ(data[i].flow, CoreAudioUtil::GetDataFlow(audio_device.get()));
+ EXPECT_TRUE(audio_device.Get());
+ EXPECT_EQ(data[i].flow, CoreAudioUtil::GetDataFlow(audio_device.Get()));
}
// Only eRender and eCapture are allowed as flow parameter.
audio_device = CoreAudioUtil::CreateDefaultDevice(eAll, eConsole);
- EXPECT_FALSE(audio_device.get());
+ EXPECT_FALSE(audio_device.Get());
}
TEST_F(CoreAudioUtilWinTest, CreateDevice) {
@@ -105,19 +105,19 @@ TEST_F(CoreAudioUtilWinTest, CreateDevice) {
CoreAudioUtil::CreateDefaultDevice(eRender, eConsole);
AudioDeviceName default_render_name;
EXPECT_TRUE(SUCCEEDED(CoreAudioUtil::GetDeviceName(
- default_render_device.get(), &default_render_name)));
+ default_render_device.Get(), &default_render_name)));
// Use the uniqe ID as input to CreateDevice() and create a corresponding
// IMMDevice.
ScopedComPtr<IMMDevice> audio_device =
CoreAudioUtil::CreateDevice(default_render_name.unique_id);
- EXPECT_TRUE(audio_device.get());
+ EXPECT_TRUE(audio_device.Get());
// Verify that the two IMMDevice interfaces represents the same endpoint
// by comparing their unique IDs.
AudioDeviceName device_name;
EXPECT_TRUE(SUCCEEDED(
- CoreAudioUtil::GetDeviceName(audio_device.get(), &device_name)));
+ CoreAudioUtil::GetDeviceName(audio_device.Get(), &device_name)));
EXPECT_EQ(default_render_name.unique_id, device_name.unique_id);
}
@@ -141,7 +141,7 @@ TEST_F(CoreAudioUtilWinTest, GetDefaultDeviceName) {
audio_device =
CoreAudioUtil::CreateDefaultDevice(data[i].flow, data[i].role);
EXPECT_TRUE(SUCCEEDED(
- CoreAudioUtil::GetDeviceName(audio_device.get(), &device_name)));
+ CoreAudioUtil::GetDeviceName(audio_device.Get(), &device_name)));
EXPECT_FALSE(device_name.device_name.empty());
EXPECT_FALSE(device_name.unique_id.empty());
}
@@ -152,7 +152,7 @@ TEST_F(CoreAudioUtilWinTest, GetAudioControllerID) {
ScopedComPtr<IMMDeviceEnumerator> enumerator(
CoreAudioUtil::CreateDeviceEnumerator());
- ASSERT_TRUE(enumerator.get());
+ ASSERT_TRUE(enumerator.Get());
// Enumerate all active input and output devices and fetch the ID of
// the associated device.
@@ -167,7 +167,7 @@ TEST_F(CoreAudioUtilWinTest, GetAudioControllerID) {
ScopedComPtr<IMMDevice> device;
collection->Item(j, device.Receive());
std::string controller_id(
- CoreAudioUtil::GetAudioControllerID(device.get(), enumerator.get()));
+ CoreAudioUtil::GetAudioControllerID(device.Get(), enumerator.Get()));
EXPECT_FALSE(controller_id.empty());
}
}
@@ -180,7 +180,7 @@ TEST_F(CoreAudioUtilWinTest, GetFriendlyName) {
ScopedComPtr<IMMDevice> audio_device =
CoreAudioUtil::CreateDefaultDevice(eCapture, eConsole);
AudioDeviceName device_name;
- HRESULT hr = CoreAudioUtil::GetDeviceName(audio_device.get(), &device_name);
+ HRESULT hr = CoreAudioUtil::GetDeviceName(audio_device.Get(), &device_name);
EXPECT_TRUE(SUCCEEDED(hr));
// Use unique ID as input to GetFriendlyName() and compare the result
@@ -191,7 +191,7 @@ TEST_F(CoreAudioUtilWinTest, GetFriendlyName) {
// Same test as above but for playback.
audio_device = CoreAudioUtil::CreateDefaultDevice(eRender, eConsole);
- hr = CoreAudioUtil::GetDeviceName(audio_device.get(), &device_name);
+ hr = CoreAudioUtil::GetDeviceName(audio_device.Get(), &device_name);
EXPECT_TRUE(SUCCEEDED(hr));
friendly_name = CoreAudioUtil::GetFriendlyName(device_name.unique_id);
EXPECT_EQ(friendly_name, device_name.device_name);
@@ -206,7 +206,7 @@ TEST_F(CoreAudioUtilWinTest, DeviceIsDefault) {
CoreAudioUtil::CreateDefaultDevice(eRender, eConsole);
AudioDeviceName name;
EXPECT_TRUE(
- SUCCEEDED(CoreAudioUtil::GetDeviceName(audio_device.get(), &name)));
+ SUCCEEDED(CoreAudioUtil::GetDeviceName(audio_device.Get(), &name)));
const std::string id = name.unique_id;
EXPECT_TRUE(CoreAudioUtil::DeviceIsDefault(eRender, eConsole, id));
EXPECT_FALSE(CoreAudioUtil::DeviceIsDefault(eCapture, eConsole, id));
@@ -220,7 +220,7 @@ TEST_F(CoreAudioUtilWinTest, CreateDefaultClient) {
for (size_t i = 0; i < arraysize(data); ++i) {
ScopedComPtr<IAudioClient> client;
client = CoreAudioUtil::CreateDefaultClient(data[i], eConsole);
- EXPECT_TRUE(client.get());
+ EXPECT_TRUE(client.Get());
}
}
@@ -233,10 +233,10 @@ TEST_F(CoreAudioUtilWinTest, CreateClient) {
ScopedComPtr<IMMDevice> device;
ScopedComPtr<IAudioClient> client;
device = CoreAudioUtil::CreateDefaultDevice(data[i], eConsole);
- EXPECT_TRUE(device.get());
- EXPECT_EQ(data[i], CoreAudioUtil::GetDataFlow(device.get()));
- client = CoreAudioUtil::CreateClient(device.get());
- EXPECT_TRUE(client.get());
+ EXPECT_TRUE(device.Get());
+ EXPECT_EQ(data[i], CoreAudioUtil::GetDataFlow(device.Get()));
+ client = CoreAudioUtil::CreateClient(device.Get());
+ EXPECT_TRUE(client.Get());
}
}
@@ -246,14 +246,14 @@ TEST_F(CoreAudioUtilWinTest, GetSharedModeMixFormat) {
ScopedComPtr<IMMDevice> device;
ScopedComPtr<IAudioClient> client;
device = CoreAudioUtil::CreateDefaultDevice(eRender, eConsole);
- EXPECT_TRUE(device.get());
- client = CoreAudioUtil::CreateClient(device.get());
- EXPECT_TRUE(client.get());
+ EXPECT_TRUE(device.Get());
+ client = CoreAudioUtil::CreateClient(device.Get());
+ EXPECT_TRUE(client.Get());
// Perform a simple sanity test of the aquired format structure.
WAVEFORMATPCMEX format;
EXPECT_TRUE(
- SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client.get(), &format)));
+ SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client.Get(), &format)));
EXPECT_GE(format.Format.nChannels, 1);
EXPECT_GE(format.Format.nSamplesPerSec, 8000u);
EXPECT_GE(format.Format.wBitsPerSample, 16);
@@ -299,12 +299,12 @@ TEST_F(CoreAudioUtilWinTest, GetDevicePeriod) {
REFERENCE_TIME shared_time_period = 0;
REFERENCE_TIME exclusive_time_period = 0;
client = CoreAudioUtil::CreateDefaultClient(data[i], eConsole);
- EXPECT_TRUE(client.get());
+ EXPECT_TRUE(client.Get());
EXPECT_TRUE(SUCCEEDED(CoreAudioUtil::GetDevicePeriod(
- client.get(), AUDCLNT_SHAREMODE_SHARED, &shared_time_period)));
+ client.Get(), AUDCLNT_SHAREMODE_SHARED, &shared_time_period)));
EXPECT_GT(shared_time_period, 0);
EXPECT_TRUE(SUCCEEDED(CoreAudioUtil::GetDevicePeriod(
- client.get(), AUDCLNT_SHAREMODE_EXCLUSIVE, &exclusive_time_period)));
+ client.Get(), AUDCLNT_SHAREMODE_EXCLUSIVE, &exclusive_time_period)));
EXPECT_GT(exclusive_time_period, 0);
EXPECT_LE(exclusive_time_period, shared_time_period);
}
@@ -321,9 +321,9 @@ TEST_F(CoreAudioUtilWinTest, GetPreferredAudioParameters) {
ScopedComPtr<IAudioClient> client;
AudioParameters params;
client = CoreAudioUtil::CreateDefaultClient(data[i], eConsole);
- EXPECT_TRUE(client.get());
+ EXPECT_TRUE(client.Get());
EXPECT_TRUE(SUCCEEDED(
- CoreAudioUtil::GetPreferredAudioParameters(client.get(), &params)));
+ CoreAudioUtil::GetPreferredAudioParameters(client.Get(), &params)));
EXPECT_TRUE(params.IsValid());
}
}
@@ -333,29 +333,29 @@ TEST_F(CoreAudioUtilWinTest, SharedModeInitialize) {
ScopedComPtr<IAudioClient> client;
client = CoreAudioUtil::CreateDefaultClient(eRender, eConsole);
- EXPECT_TRUE(client.get());
+ EXPECT_TRUE(client.Get());
WAVEFORMATPCMEX format;
EXPECT_TRUE(
- SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client.get(), &format)));
+ SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client.Get(), &format)));
// Perform a shared-mode initialization without event-driven buffer handling.
uint32_t endpoint_buffer_size = 0;
- HRESULT hr = CoreAudioUtil::SharedModeInitialize(client.get(), &format, NULL,
+ HRESULT hr = CoreAudioUtil::SharedModeInitialize(client.Get(), &format, NULL,
&endpoint_buffer_size, NULL);
EXPECT_TRUE(SUCCEEDED(hr));
EXPECT_GT(endpoint_buffer_size, 0u);
// It is only possible to create a client once.
- hr = CoreAudioUtil::SharedModeInitialize(client.get(), &format, NULL,
+ hr = CoreAudioUtil::SharedModeInitialize(client.Get(), &format, NULL,
&endpoint_buffer_size, NULL);
EXPECT_FALSE(SUCCEEDED(hr));
EXPECT_EQ(hr, AUDCLNT_E_ALREADY_INITIALIZED);
// Verify that it is possible to reinitialize the client after releasing it.
client = CoreAudioUtil::CreateDefaultClient(eRender, eConsole);
- EXPECT_TRUE(client.get());
- hr = CoreAudioUtil::SharedModeInitialize(client.get(), &format, NULL,
+ EXPECT_TRUE(client.Get());
+ hr = CoreAudioUtil::SharedModeInitialize(client.Get(), &format, NULL,
&endpoint_buffer_size, NULL);
EXPECT_TRUE(SUCCEEDED(hr));
EXPECT_GT(endpoint_buffer_size, 0u);
@@ -364,11 +364,11 @@ TEST_F(CoreAudioUtilWinTest, SharedModeInitialize) {
// A simple way to emulate an invalid format is to use the shared-mode
// mixing format and modify the preferred sample.
client = CoreAudioUtil::CreateDefaultClient(eRender, eConsole);
- EXPECT_TRUE(client.get());
+ EXPECT_TRUE(client.Get());
format.Format.nSamplesPerSec = format.Format.nSamplesPerSec + 1;
EXPECT_FALSE(CoreAudioUtil::IsFormatSupported(
- client.get(), AUDCLNT_SHAREMODE_SHARED, &format));
- hr = CoreAudioUtil::SharedModeInitialize(client.get(), &format, NULL,
+ client.Get(), AUDCLNT_SHAREMODE_SHARED, &format));
+ hr = CoreAudioUtil::SharedModeInitialize(client.Get(), &format, NULL,
&endpoint_buffer_size, NULL);
EXPECT_TRUE(FAILED(hr));
EXPECT_EQ(hr, E_INVALIDARG);
@@ -379,13 +379,13 @@ TEST_F(CoreAudioUtilWinTest, SharedModeInitialize) {
// The event handle should be in the nonsignaled state.
base::win::ScopedHandle event_handle(::CreateEvent(NULL, TRUE, FALSE, NULL));
client = CoreAudioUtil::CreateDefaultClient(eRender, eConsole);
- EXPECT_TRUE(client.get());
+ EXPECT_TRUE(client.Get());
EXPECT_TRUE(
- SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client.get(), &format)));
+ SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client.Get(), &format)));
EXPECT_TRUE(CoreAudioUtil::IsFormatSupported(
- client.get(), AUDCLNT_SHAREMODE_SHARED, &format));
+ client.Get(), AUDCLNT_SHAREMODE_SHARED, &format));
hr = CoreAudioUtil::SharedModeInitialize(
- client.get(), &format, event_handle.Get(), &endpoint_buffer_size, NULL);
+ client.Get(), &format, event_handle.Get(), &endpoint_buffer_size, NULL);
EXPECT_TRUE(SUCCEEDED(hr));
EXPECT_GT(endpoint_buffer_size, 0u);
}
@@ -404,32 +404,32 @@ TEST_F(CoreAudioUtilWinTest, CreateRenderAndCaptureClients) {
ScopedComPtr<IAudioCaptureClient> capture_client;
client = CoreAudioUtil::CreateDefaultClient(data[i], eConsole);
- EXPECT_TRUE(client.get());
+ EXPECT_TRUE(client.Get());
EXPECT_TRUE(SUCCEEDED(
- CoreAudioUtil::GetSharedModeMixFormat(client.get(), &format)));
+ CoreAudioUtil::GetSharedModeMixFormat(client.Get(), &format)));
if (data[i] == eRender) {
// It is not possible to create a render client using an unitialized
// client interface.
- render_client = CoreAudioUtil::CreateRenderClient(client.get());
- EXPECT_FALSE(render_client.get());
+ render_client = CoreAudioUtil::CreateRenderClient(client.Get());
+ EXPECT_FALSE(render_client.Get());
// Do a proper initialization and verify that it works this time.
- CoreAudioUtil::SharedModeInitialize(client.get(), &format, NULL,
+ CoreAudioUtil::SharedModeInitialize(client.Get(), &format, NULL,
&endpoint_buffer_size, NULL);
- render_client = CoreAudioUtil::CreateRenderClient(client.get());
- EXPECT_TRUE(render_client.get());
+ render_client = CoreAudioUtil::CreateRenderClient(client.Get());
+ EXPECT_TRUE(render_client.Get());
EXPECT_GT(endpoint_buffer_size, 0u);
} else if (data[i] == eCapture) {
// It is not possible to create a capture client using an unitialized
// client interface.
- capture_client = CoreAudioUtil::CreateCaptureClient(client.get());
- EXPECT_FALSE(capture_client.get());
+ capture_client = CoreAudioUtil::CreateCaptureClient(client.Get());
+ EXPECT_FALSE(capture_client.Get());
// Do a proper initialization and verify that it works this time.
- CoreAudioUtil::SharedModeInitialize(client.get(), &format, NULL,
+ CoreAudioUtil::SharedModeInitialize(client.Get(), &format, NULL,
&endpoint_buffer_size, NULL);
- capture_client = CoreAudioUtil::CreateCaptureClient(client.get());
- EXPECT_TRUE(capture_client.get());
+ capture_client = CoreAudioUtil::CreateCaptureClient(client.Get());
+ EXPECT_TRUE(capture_client.Get());
EXPECT_GT(endpoint_buffer_size, 0u);
}
}
@@ -441,19 +441,19 @@ TEST_F(CoreAudioUtilWinTest, FillRenderEndpointBufferWithSilence) {
// Create default clients using the default mixing format for shared mode.
ScopedComPtr<IAudioClient> client(
CoreAudioUtil::CreateDefaultClient(eRender, eConsole));
- EXPECT_TRUE(client.get());
+ EXPECT_TRUE(client.Get());
WAVEFORMATPCMEX format;
uint32_t endpoint_buffer_size = 0;
EXPECT_TRUE(
- SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client.get(), &format)));
- CoreAudioUtil::SharedModeInitialize(client.get(), &format, NULL,
+ SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client.Get(), &format)));
+ CoreAudioUtil::SharedModeInitialize(client.Get(), &format, NULL,
&endpoint_buffer_size, NULL);
EXPECT_GT(endpoint_buffer_size, 0u);
ScopedComPtr<IAudioRenderClient> render_client(
- CoreAudioUtil::CreateRenderClient(client.get()));
- EXPECT_TRUE(render_client.get());
+ CoreAudioUtil::CreateRenderClient(client.Get()));
+ EXPECT_TRUE(render_client.Get());
// The endpoint audio buffer should not be filled up by default after being
// created.
@@ -466,7 +466,7 @@ TEST_F(CoreAudioUtilWinTest, FillRenderEndpointBufferWithSilence) {
// since we can't access data that has already been sent to the endpoint
// buffer.
EXPECT_TRUE(CoreAudioUtil::FillRenderEndpointBufferWithSilence(
- client.get(), render_client.get()));
+ client.Get(), render_client.Get()));
client->GetCurrentPadding(&num_queued_frames);
EXPECT_EQ(num_queued_frames, endpoint_buffer_size);
}
@@ -480,7 +480,7 @@ TEST_F(CoreAudioUtilWinTest, GetMatchingOutputDeviceID) {
ScopedComPtr<IMMDeviceEnumerator> enumerator(
CoreAudioUtil::CreateDeviceEnumerator());
- ASSERT_TRUE(enumerator.get());
+ ASSERT_TRUE(enumerator.Get());
// Enumerate all active input and output devices and fetch the ID of
// the associated device.
« no previous file with comments | « media/audio/win/core_audio_util_win.cc ('k') | media/base/win/mf_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698