chromium/content/browser/media/media_devices_util_browsertest.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/task/bind_post_task.h"
#include "content/browser/media/media_devices_util.h"

#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/test_future.h"
#include "content/browser/browser_main_loop.h"
#include "content/browser/renderer_host/media/media_devices_manager.h"
#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/media_device_id.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/content_browser_test.h"
#include "content/shell/browser/shell.h"
#include "media/audio/audio_device_description.h"
#include "media/base/media_switches.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/mediastream/media_devices.mojom-shared.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h"
#include "url/origin.h"

namespace content {

MediaDeviceType;
MediaStreamType;
ElementsAre;
Eq;
Optional;

namespace {

// Returns true if the `device_id` corresponds to the system default or
// communications device, false otherwise.
bool IsSpecialAudioDeviceId(MediaDeviceType device_type,
                            const std::string& device_id) {}

std::optional<MediaStreamType> ToMediaStreamType(MediaDeviceType device_type) {}

void VerifyHMACDeviceID(MediaDeviceType device_type,
                        const std::string& hmac_device_id,
                        const std::string& raw_device_id) {}

blink::StreamControls GetAudioStreamControls(std::string hmac_device_id) {}

blink::mojom::StreamSelectionInfoPtr NewSearchBySessionId(
    base::flat_map<std::string, base::UnguessableToken> session_id_map) {}

}  // namespace

class MediaDevicesUtilBrowserTest : public ContentBrowserTest {};

// This test provides coverage for the utilities in
// content/public/media_device_id.h
IN_PROC_BROWSER_TEST_F(MediaDevicesUtilBrowserTest, TranslateDeviceIdAndBack) {}

IN_PROC_BROWSER_TEST_F(MediaDevicesUtilBrowserTest,
                       GetMediaDeviceSaltAndOrigin) {}

IN_PROC_BROWSER_TEST_F(MediaDevicesUtilBrowserTest,
                       TranslateMediaDeviceInfoArrayWithPermission) {}

IN_PROC_BROWSER_TEST_F(MediaDevicesUtilBrowserTest,
                       TranslateMediaDeviceInfoArrayWithoutPermission) {}

IN_PROC_BROWSER_TEST_F(MediaDevicesUtilBrowserTest, TranslationWithoutSalt) {}

IN_PROC_BROWSER_TEST_F(MediaDevicesUtilBrowserTest,
                       GetRawMediaDeviceIDForHMAC) {}

IN_PROC_BROWSER_TEST_F(MediaDevicesUtilBrowserTest, GetRawAudioOutputDeviceID) {}

IN_PROC_BROWSER_TEST_F(MediaDevicesUtilBrowserTest,
                       GetRawDeviceIDForNonexistingHMAC) {}

IN_PROC_BROWSER_TEST_F(MediaDevicesUtilBrowserTest,
                       GetMediaCaptureRawDeviceIdsOpenedForWebContents) {}

}  // namespace content