#include "components/webrtc/media_stream_devices_controller.h"
#include "base/test/bind.h"
#include "base/test/test_future.h"
#include "components/webrtc/media_stream_devices_util.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/mock_permission_controller.h"
#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_web_contents_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"
#if BUILDFLAG(IS_ANDROID)
#include "content/public/browser/render_widget_host_view.h"
#include "ui/android/window_android.h"
#endif
_;
namespace {
blink::MediaStreamDevices CreateFakeDevices(
blink::mojom::MediaStreamType type) { … }
class FakeEnumerator : public webrtc::MediaStreamDeviceEnumeratorImpl { … };
class MockPermissionController : public content::MockPermissionController { … };
std::vector<std::string> GetIds(const blink::MediaStreamDevices& devices,
size_t start_index) { … }
}
class MediaStreamDevicesControllerTest : public testing::Test { … };
TEST_F(MediaStreamDevicesControllerTest,
RequestPermissions_MEDIA_GENERATE_STREAM) { … }
TEST_F(MediaStreamDevicesControllerTest,
RequestPermissions_MEDIA_DEVICE_ACCESS) { … }
TEST_F(
MediaStreamDevicesControllerTest,
RequestPermissions_OPEN_DEVICE_PEPPER_ONLY_Audio_UsesDefualtWhenNoRequestedDevices) { … }
TEST_F(MediaStreamDevicesControllerTest,
RequestPermissions_OPEN_DEVICE_PEPPER_ONLY_Audio_UsesRequestedDevices) { … }
TEST_F(
MediaStreamDevicesControllerTest,
RequestPermissions_OPEN_DEVICE_PEPPER_ONLY_Video_UsesDefualtWhenNoRequestedDevices) { … }
TEST_F(MediaStreamDevicesControllerTest,
RequestPermissions_OPEN_DEVICE_PEPPER_ONLY_Video_UsesRequestedDevices) { … }