#include "chrome/browser/permissions/contextual_notification_permission_ui_selector.h"
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "base/memory/scoped_refptr.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/permissions/crowd_deny.pb.h"
#include "chrome/browser/permissions/crowd_deny_fake_safe_browsing_database_manager.h"
#include "chrome/browser/permissions/crowd_deny_preload_data.h"
#include "chrome/browser/permissions/quiet_notification_permission_ui_config.h"
#include "chrome/browser/safe_browsing/test_safe_browsing_service.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "components/content_settings/core/common/pref_names.h"
#include "components/permissions/request_type.h"
#include "components/permissions/test/mock_permission_request.h"
#include "components/prefs/testing_pref_service.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace {
QuietUiReason;
WarningReason;
Decision;
constexpr char kTestDomainUnknown[] = …;
constexpr char kTestDomainAcceptable[] = …;
constexpr char kTestDomainSpammy[] = …;
constexpr char kTestDomainSpammyWarn[] = …;
constexpr char kTestDomainAbusivePrompts[] = …;
constexpr char kTestDomainAbusivePromptsWarn[] = …;
constexpr char kTestOriginNoData[] = …;
constexpr char kTestOriginUnknown[] = …;
constexpr char kTestOriginAcceptable[] = …;
constexpr char kTestOriginSpammy[] = …;
constexpr char kTestOriginSpammyWarn[] = …;
constexpr char kTestOriginAbusivePrompts[] = …;
constexpr char kTestOriginSubDomainOfAbusivePrompts[] = …;
constexpr char kTestOriginAbusivePromptsWarn[] = …;
constexpr char kTestOriginAbusiveContent[] = …;
constexpr char kTestOriginAbusiveContentWarn[] = …;
constexpr char kTestOriginDisruptive[] = …;
constexpr const char* kAllTestingOrigins[] = …;
}
class ContextualNotificationPermissionUiSelectorTest : public testing::Test { … };
TEST_F(ContextualNotificationPermissionUiSelectorTest,
PrefAndSafeBrowsingCombinations) { … }
TEST_F(ContextualNotificationPermissionUiSelectorTest, FeatureDisabled) { … }
TEST_F(ContextualNotificationPermissionUiSelectorTest, AllTriggersDisabled) { … }
TEST_F(ContextualNotificationPermissionUiSelectorTest, OnlyCrowdDenyEnabled) { … }
TEST_F(ContextualNotificationPermissionUiSelectorTest,
OnlyAbusiveContentBlockingEnabled) { … }
TEST_F(ContextualNotificationPermissionUiSelectorTest,
OnlyAbusiveContentWarningsEnabled) { … }
TEST_F(ContextualNotificationPermissionUiSelectorTest,
OnlyAbusivePromptBlockingEnabled) { … }
TEST_F(ContextualNotificationPermissionUiSelectorTest,
OnlyAbusivePromptWarningsEnabled) { … }
TEST_F(ContextualNotificationPermissionUiSelectorTest,
OnlyDisruptiveBehaviorRequestBlockingEnabled) { … }
TEST_F(ContextualNotificationPermissionUiSelectorTest,
CrowdDenyHoldbackChance) { … }