| Index: content/browser/renderer_host/media/audio_input_device_manager_unittest.cc
|
| diff --git a/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc b/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc
|
| index 8b8fcb7e03441b3a721ad52561338521a7d6762e..2eb41060ec36cf1c9061ffba3bc1778390c8892f 100644
|
| --- a/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc
|
| +++ b/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc
|
| @@ -11,6 +11,7 @@
|
| #include "content/browser/browser_thread_impl.h"
|
| #include "content/browser/renderer_host/media/audio_input_device_manager.h"
|
| #include "content/browser/renderer_host/media/audio_input_device_manager_event_handler.h"
|
| +#include "content/public/common/media_stream_request.h"
|
| #include "media/audio/audio_manager_base.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -38,7 +39,7 @@ class MockAudioInputDeviceManagerListener
|
|
|
| virtual void DevicesEnumerated(MediaStreamType service_type,
|
| const StreamDeviceInfoArray& devices) {
|
| - if (service_type != content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE)
|
| + if (!content::IsAudioMediaType(service_type))
|
| return;
|
|
|
| devices_ = devices;
|
| @@ -98,7 +99,8 @@ class AudioInputDeviceManagerTest : public testing::Test {
|
| message_loop_.get()));
|
|
|
| audio_manager_.reset(media::AudioManager::Create());
|
| - manager_ = new AudioInputDeviceManager(audio_manager_.get());
|
| + manager_ = new AudioInputDeviceManager(
|
| + audio_manager_.get(), content::MEDIA_DEVICE_AUDIO_CAPTURE);
|
| audio_input_listener_.reset(new MockAudioInputDeviceManagerListener());
|
| manager_->Register(audio_input_listener_.get(),
|
| message_loop_->message_loop_proxy());
|
| @@ -145,12 +147,10 @@ TEST_F(AudioInputDeviceManagerTest, OpenAndCloseDevice) {
|
|
|
| // Expected mock call with expected return value.
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Opened(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - session_id))
|
| + Opened(content::MEDIA_DEVICE_AUDIO_CAPTURE, session_id))
|
| .Times(1);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - session_id))
|
| + Closed(content::MEDIA_DEVICE_AUDIO_CAPTURE, session_id))
|
| .Times(1);
|
|
|
| // Waits for the callback.
|
| @@ -180,8 +180,7 @@ TEST_F(AudioInputDeviceManagerTest, OpenMultipleDevices) {
|
|
|
| // Expected mock call with expected returned value.
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Opened(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - session_id[index]))
|
| + Opened(content::MEDIA_DEVICE_AUDIO_CAPTURE, session_id[index]))
|
| .Times(1);
|
|
|
| // Waits for the callback.
|
| @@ -199,8 +198,7 @@ TEST_F(AudioInputDeviceManagerTest, OpenMultipleDevices) {
|
| // Closes the devices.
|
| manager_->Close(session_id[i]);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - session_id[i]))
|
| + Closed(content::MEDIA_DEVICE_AUDIO_CAPTURE, session_id[i]))
|
| .Times(1);
|
|
|
| // Waits for the callback.
|
| @@ -214,15 +212,14 @@ TEST_F(AudioInputDeviceManagerTest, OpenNotExistingDevice) {
|
| return;
|
| InSequence s;
|
|
|
| - MediaStreamType stream_type = content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE;
|
| + MediaStreamType stream_type = content::MEDIA_DEVICE_AUDIO_CAPTURE;
|
| std::string device_name("device_doesnt_exist");
|
| std::string device_id("id_doesnt_exist");
|
| StreamDeviceInfo dummy_device(stream_type, device_name, device_id, false);
|
|
|
| int session_id = manager_->Open(dummy_device);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Opened(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - session_id))
|
| + Opened(content::MEDIA_DEVICE_AUDIO_CAPTURE, session_id))
|
| .Times(1);
|
|
|
| // Waits for the callback.
|
| @@ -249,20 +246,16 @@ TEST_F(AudioInputDeviceManagerTest, OpenDeviceTwice) {
|
| // Expected mock calls with expected returned values.
|
| EXPECT_NE(first_session_id, second_session_id);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Opened(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - first_session_id))
|
| + Opened(content::MEDIA_DEVICE_AUDIO_CAPTURE, first_session_id))
|
| .Times(1);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Opened(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - second_session_id))
|
| + Opened(content::MEDIA_DEVICE_AUDIO_CAPTURE, second_session_id))
|
| .Times(1);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - first_session_id))
|
| + Closed(content::MEDIA_DEVICE_AUDIO_CAPTURE, first_session_id))
|
| .Times(1);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - second_session_id))
|
| + Closed(content::MEDIA_DEVICE_AUDIO_CAPTURE, second_session_id))
|
| .Times(1);
|
|
|
| // Waits for the callback.
|
| @@ -296,8 +289,7 @@ TEST_F(AudioInputDeviceManagerTest, StartAndStopSession) {
|
| // stopped the device before calling close.
|
| session_id[index] = manager_->Open(*iter);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Opened(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - session_id[index]))
|
| + Opened(content::MEDIA_DEVICE_AUDIO_CAPTURE, session_id[index]))
|
| .Times(1);
|
| message_loop_->RunAllPending();
|
|
|
| @@ -310,8 +302,7 @@ TEST_F(AudioInputDeviceManagerTest, StartAndStopSession) {
|
| manager_->Stop(session_id[index]);
|
| manager_->Close(session_id[index]);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - session_id[index]))
|
| + Closed(content::MEDIA_DEVICE_AUDIO_CAPTURE, session_id[index]))
|
| .Times(1);
|
| message_loop_->RunAllPending();
|
| }
|
| @@ -343,8 +334,7 @@ TEST_F(AudioInputDeviceManagerTest, CloseWithoutStopSession) {
|
| // Calls Open()/Start()/Close() for each device.
|
| session_id[index] = manager_->Open(*iter);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Opened(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - session_id[index]))
|
| + Opened(content::MEDIA_DEVICE_AUDIO_CAPTURE, session_id[index]))
|
| .Times(1);
|
| message_loop_->RunAllPending();
|
|
|
| @@ -361,8 +351,7 @@ TEST_F(AudioInputDeviceManagerTest, CloseWithoutStopSession) {
|
| DeviceStopped(session_id[index]))
|
| .Times(1);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - session_id[index]))
|
| + Closed(content::MEDIA_DEVICE_AUDIO_CAPTURE, session_id[index]))
|
| .Times(1);
|
| message_loop_->RunAllPending();
|
| }
|
| @@ -392,12 +381,10 @@ TEST_F(AudioInputDeviceManagerTest, StartDeviceTwice) {
|
| int second_session_id = manager_->Open(*iter);
|
| EXPECT_NE(first_session_id, second_session_id);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Opened(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - first_session_id))
|
| + Opened(content::MEDIA_DEVICE_AUDIO_CAPTURE, first_session_id))
|
| .Times(1);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Opened(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - second_session_id))
|
| + Opened(content::MEDIA_DEVICE_AUDIO_CAPTURE, second_session_id))
|
| .Times(1);
|
| message_loop_->RunAllPending();
|
|
|
| @@ -419,12 +406,10 @@ TEST_F(AudioInputDeviceManagerTest, StartDeviceTwice) {
|
| manager_->Close(first_session_id);
|
| manager_->Close(second_session_id);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - first_session_id))
|
| + Closed(content::MEDIA_DEVICE_AUDIO_CAPTURE, first_session_id))
|
| .Times(1);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - second_session_id))
|
| + Closed(content::MEDIA_DEVICE_AUDIO_CAPTURE, second_session_id))
|
| .Times(1);
|
| message_loop_->RunAllPending();
|
| }
|
| @@ -445,8 +430,7 @@ TEST_F(AudioInputDeviceManagerTest, StartInvalidSession) {
|
| audio_input_listener_->devices_.begin();
|
| int session_id = manager_->Open(*iter);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Opened(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - session_id))
|
| + Opened(content::MEDIA_DEVICE_AUDIO_CAPTURE, session_id))
|
| .Times(1);
|
| message_loop_->RunAllPending();
|
|
|
| @@ -461,8 +445,7 @@ TEST_F(AudioInputDeviceManagerTest, StartInvalidSession) {
|
|
|
| manager_->Close(session_id);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - session_id))
|
| + Closed(content::MEDIA_DEVICE_AUDIO_CAPTURE, session_id))
|
| .Times(1);
|
| message_loop_->RunAllPending();
|
| }
|
| @@ -484,8 +467,7 @@ TEST_F(AudioInputDeviceManagerTest, StartSessionTwice) {
|
| audio_input_listener_->devices_.begin();
|
| int session_id = manager_->Open(*iter);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Opened(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - session_id))
|
| + Opened(content::MEDIA_DEVICE_AUDIO_CAPTURE, session_id))
|
| .Times(1);
|
| message_loop_->RunAllPending();
|
|
|
| @@ -506,8 +488,7 @@ TEST_F(AudioInputDeviceManagerTest, StartSessionTwice) {
|
| manager_->Stop(session_id);
|
| manager_->Close(session_id);
|
| EXPECT_CALL(*audio_input_listener_,
|
| - Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE,
|
| - session_id))
|
| + Closed(content::MEDIA_DEVICE_AUDIO_CAPTURE, session_id))
|
| .Times(1);
|
| message_loop_->RunAllPending();
|
| }
|
|
|