#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) { … }
}
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[] = …;
}
class PermissionPromptBubbleOneOriginViewTestMediaPreview
: public TestWithBrowserView { … };
TEST_F(PermissionPromptBubbleOneOriginViewTestMediaPreview,
MediaPreviewMicOnly) { … }
TEST_F(PermissionPromptBubbleOneOriginViewTestMediaPreview,
MediaPreviewCameraOnly) { … }
TEST_F(PermissionPromptBubbleOneOriginViewTestMediaPreview,
MediaPreviewPTZCameraOnly) { … }
TEST_F(PermissionPromptBubbleOneOriginViewTestMediaPreview,
MediaPreviewCameraAndMic) { … }
TEST_F(PermissionPromptBubbleOneOriginViewTestMediaPreview,
MediaPreviewNoCameraOrMic) { … }
#endif