chromium/chrome/browser/ui/views/permissions/permission_prompt_bubble_one_origin_view_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 "chrome/browser/ui/views/permissions/permission_prompt_bubble_one_origin_view.h"

#include "base/containers/to_vector.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "chrome/browser/ui/views/permissions/permission_prompt_bubble_base_view.h"
#include "chrome/browser/ui/views/permissions/permission_prompt_style.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/views/chrome_views_test_base.h"
#include "components/permissions/permission_util.h"
#include "components/permissions/request_type.h"
#include "components/permissions/test/mock_permission_request.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"

#if !BUILDFLAG(IS_CHROMEOS)
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_future.h"
#include "chrome/browser/ui/views/frame/test_with_browser_view.h"
#include "components/media_effects/test/fake_audio_service.h"
#include "components/media_effects/test/fake_video_capture_service.h"
#include "components/media_effects/test/scoped_media_device_info.h"
#include "components/strings/grit/components_strings.h"
#include "third_party/blink/public/common/features.h"
#endif

Bucket;
ElementsAre;
PermissionPromptBubbleOneOriginViewTest;

namespace {

class TestDelegate : public permissions::PermissionPrompt::Delegate {};

std::unique_ptr<PermissionPromptBubbleOneOriginView> CreateBubble(
    TestDelegate* delegate) {}

}  // namespace

TEST_F(PermissionPromptBubbleOneOriginViewTest,
       AccessibleTitleMentionsOriginAndPermissions) {}

TEST_F(PermissionPromptBubbleOneOriginViewTest,
       AccessibleTitleDoesNotMentionTooManyPermissions) {}

TEST_F(PermissionPromptBubbleOneOriginViewTest,
       AccessibleTitleFileSchemeMentionsThisFile) {}

TEST_F(PermissionPromptBubbleOneOriginViewTest,
       AccessibleTitleIncludesOnlyVisiblePermissions) {}

#if !BUILDFLAG(IS_CHROMEOS)

namespace {

constexpr char kCameraId[] =;
constexpr char kCameraName[] =;
constexpr char kCameraId2[] =;
constexpr char kCameraName2[] =;

constexpr char kMicId[] =;
constexpr char kMicName[] =;
constexpr char kGroupId[] =;
constexpr char kMicId2[] =;
constexpr char kMicName2[] =;
constexpr char kGroupId2[] =;

constexpr char kOriginTrialAllowedHistogramName[] =;

}  // namespace

// Takes care of all setup needed to initialize page info permission prompt one
// origin view (e.g. permission prompt delegate, ...), as well as media previews
// (e.g. audio service, video service, ...).
class PermissionPromptBubbleOneOriginViewTestMediaPreview
    : public TestWithBrowserView {};

// Verify the device counter as well as the tooltip for the mic permission
// label.
TEST_F(PermissionPromptBubbleOneOriginViewTestMediaPreview,
       MediaPreviewMicOnly) {}

// Verify the device counter as well as the tooltip for the camera permission
// label.
TEST_F(PermissionPromptBubbleOneOriginViewTestMediaPreview,
       MediaPreviewCameraOnly) {}

// Verify the device counter as well as the tooltip for the ptz camera
// permission label.
TEST_F(PermissionPromptBubbleOneOriginViewTestMediaPreview,
       MediaPreviewPTZCameraOnly) {}

// Verify the device counter as well as the tooltip for both the camera and the
// mic permission labels.
TEST_F(PermissionPromptBubbleOneOriginViewTestMediaPreview,
       MediaPreviewCameraAndMic) {}

// Verify there is no preview created when there is no camera or mic permissions
// requested.
TEST_F(PermissionPromptBubbleOneOriginViewTestMediaPreview,
       MediaPreviewNoCameraOrMic) {}

#endif