#include "chrome/browser/notifications/screen_capture_notification_blocker.h"
#include <optional>
#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "chrome/browser/media/webrtc/media_stream_capture_indicator.h"
#include "chrome/browser/notifications/muted_notification_handler.h"
#include "chrome/browser/notifications/notification_blocker.h"
#include "chrome/browser/notifications/notification_handler.h"
#include "chrome/browser/notifications/stub_notification_display_service.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_web_contents_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/message_center/public/cpp/notification.h"
#include "url/gurl.h"
namespace {
message_center::Notification CreateNotification(const GURL& origin,
const std::string& id) { … }
message_center::Notification CreateNotification(const GURL& origin) { … }
}
class MockNotificationBlockerObserver : public NotificationBlocker::Observer { … };
class ScreenCaptureNotificationBlockerTest
: public testing::TestWithParam<bool> { … };
TEST_P(ScreenCaptureNotificationBlockerTest, ShouldNotBlockWhenNotCapturing) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, ShouldNotBlockCapturingOrigin) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, ShouldBlockWhenCapturing) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, ShouldBlockWhenCapturingMutliple) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, CapturingTwice) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, StopUnknownContents) { … }
TEST_P(ScreenCaptureNotificationBlockerTest,
ObservesMediaStreamCaptureIndicator) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, ShowsMutedNotification) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, UpdatesMutedNotification) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, ClosesMutedNotification) { … }
TEST_P(ScreenCaptureNotificationBlockerTest,
ClosesMutedNotificationOnBodyClick) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, ShowsMutedNotificationAfterClose) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, SnoozeAction) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, SnoozeActionShowOnNextSession) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, ShowAction) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, SnoozeClickHistogram) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, SessionEndHistograms) { … }
TEST_P(ScreenCaptureNotificationBlockerTest, SessionTimingHistograms) { … }
INSTANTIATE_TEST_SUITE_P(…);