#include "chrome/browser/notifications/notification_permission_context.h"
#include <memory>
#include <string>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/test/scoped_mock_time_message_loop_task_runner.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/permissions/permission_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/permissions/permission_request_id.h"
#include "content/public/browser/permission_controller_delegate.h"
#include "content/public/browser/permission_result.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_task_environment.h"
#include "extensions/buildflags/buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/permissions/permission_status.mojom.h"
#include "url/gurl.h"
#if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h"
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/notifications/notifier_state_tracker.h"
#include "chrome/browser/notifications/notifier_state_tracker_factory.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "ui/message_center/public/cpp/notifier_id.h"
#endif
namespace {
PermissionStatus;
void StoreContentSetting(ContentSetting* out_content_setting,
ContentSetting content_setting) { … }
class TestNotificationPermissionContext : public NotificationPermissionContext { … };
}
class NotificationPermissionContextTest
: public ChromeRenderViewHostTestHarness { … };
TEST_F(NotificationPermissionContextTest, CrossOriginPermissionChecks) { … }
TEST_F(NotificationPermissionContextTest, WebNotificationsTopLevelOriginOnly) { … }
TEST_F(NotificationPermissionContextTest, SecureOriginRequirement) { … }
#if BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64)
#define MAYBE_TestDenyInIncognitoAfterDelay …
#else
#define MAYBE_TestDenyInIncognitoAfterDelay …
#endif
TEST_F(NotificationPermissionContextTest, MAYBE_TestDenyInIncognitoAfterDelay) { … }
TEST_F(NotificationPermissionContextTest, TestParallelDenyInIncognito) { … }
TEST_F(NotificationPermissionContextTest, GetNotificationsSettings) { … }
#if BUILDFLAG(ENABLE_EXTENSIONS)
TEST_F(NotificationPermissionContextTest, ExtensionPermissionAskByDefault) { … }
TEST_F(NotificationPermissionContextTest, ExtensionPermissionGranted) { … }
TEST_F(NotificationPermissionContextTest, ExtensionPermissionOverrideDenied) { … }
#endif