chromium/chrome/browser/media/webrtc/display_media_access_handler_browsertest.cc

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

#include "chrome/browser/media/webrtc/display_media_access_handler.h"

#include "base/run_loop.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/media/webrtc/desktop_media_picker_manager.h"
#include "chrome/browser/media/webrtc/webrtc_browsertest_base.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"

#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/crosapi/mojom/screen_manager.mojom.h"
#include "chromeos/lacros/lacros_service.h"
#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)

class DisplayMediaAccessHandlerTest
    : public testing::WithParamInterface<bool>,
      public WebRtcTestBase,
      public DesktopMediaPickerManager::DialogObserver {};

// Verify that the display media picker will show up by default.
IN_PROC_BROWSER_TEST_F(DisplayMediaAccessHandlerTest, ShowPickerByDefault) {}

// Verify that the request will be rejected when the video stream is not
// requested by default.
IN_PROC_BROWSER_TEST_F(DisplayMediaAccessHandlerTest, RejectNoVideoByDefault) {}

// Verify that when `ContentSettingsType::DISPLAY_MEDIA_SYSTEM_AUDIO` is set,
// the display media selection dialog can be bypassed and the system audio track
// will be available by default.
IN_PROC_BROWSER_TEST_F(DisplayMediaAccessHandlerTest, ForceSystemAudio) {}

// Verify that `ContentSettingsType::DISPLAY_MEDIA_SYSTEM_AUDIO` does not work
// when the system audio is excluded and the request should be rejected.
IN_PROC_BROWSER_TEST_F(DisplayMediaAccessHandlerTest,
                       ForceSystemAudioButExcluded) {}

// Verify that `ContentSettingsType::DISPLAY_MEDIA_SYSTEM_AUDIO` does not work
// when the video stream is requested and should fallback to the original
// behavior.
IN_PROC_BROWSER_TEST_F(DisplayMediaAccessHandlerTest,
                       ForceSystemAudioWithVideoStream) {}