chromium/content/browser/media/captured_surface_controller_permission_manager_unittest.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 "content/browser/media/captured_surface_control_permission_manager.h"

#include <memory>

#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/permission_request_description.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/test/mock_permission_controller.h"
#include "content/test/test_render_frame_host.h"
#include "content/test/test_web_contents.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"

namespace content {
namespace {

PermissionStatus;
PermissionManager;
CallbackType;
CallbackActionType;

// Extends MockPermissionController and allows test suites to conveniently
// determine whether a prompt was shown, as well as simulate when and how the
// user interacts with the prompts.
class CscMockPermissionController : public MockPermissionController {};

// Encapsulates the state and logic of an invocation of
// CapturedSurfaceControlPermissionManager::CheckPermission(),
// thereby allowing us to conveniently test the interaction
// between multiple calls.
class PermissionCheckState final {};

class CapturedSurfaceControlPermissionManagerTest
    : public RenderViewHostTestHarness,
      public ::testing::WithParamInterface<bool> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(CapturedSurfaceControlPermissionManagerTest,
       UserNotPromptedOnFirstCheckAndHasNoTransientActivation) {}

TEST_P(CapturedSurfaceControlPermissionManagerTest,
       UserPromptedOnFirstCheckAndHasTransientActivation) {}

TEST_P(CapturedSurfaceControlPermissionManagerTest,
       DeniedReportedIfUserDeniesPrompt) {}

TEST_P(CapturedSurfaceControlPermissionManagerTest,
       GrantedReportedIfUserApprovesPrompt) {}

TEST_P(CapturedSurfaceControlPermissionManagerTest,
       AfterFirstGrantNoPromptAndNoActivationRequirement) {}

TEST_P(CapturedSurfaceControlPermissionManagerTest, CanGrantAfterDenying) {}

TEST_P(CapturedSurfaceControlPermissionManagerTest, EmbargoObserved) {}

TEST_P(CapturedSurfaceControlPermissionManagerTest,
       AdditionalPermissionChecksDeniedWhilePromptPending) {}

TEST_P(CapturedSurfaceControlPermissionManagerTest,
       SubsequentPermissionChecksAllowedAfterPromptAcceptedByUser) {}

TEST_P(CapturedSurfaceControlPermissionManagerTest,
       SubsequentPermissionChecksCauseNewPromptAfterPromptRejecdByUser) {}

TEST_P(CapturedSurfaceControlPermissionManagerTest,
       CallFailsIfCapturerUnfocused) {}

TEST_P(CapturedSurfaceControlPermissionManagerTest,
       UserPromptedIfCapturerFocused) {}

}  // namespace
}  // namespace content