#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include <memory>
#include "base/test/bind.h"
#include "build/build_config.h"
#include "chrome/browser/download/download_item_warning_data.h"
#include "chrome/browser/safe_browsing/chrome_ping_manager_factory.h"
#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "components/download/public/common/download_danger_type.h"
#include "components/download/public/common/mock_download_item.h"
#include "components/safe_browsing/content/browser/safe_browsing_service_interface.h"
#include "components/safe_browsing/core/browser/ping_manager.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/proto/csd.pb.h"
#include "components/safe_browsing/core/common/safe_browsing_policy_handler.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/browser/download_item_utils.h"
#include "content/public/test/browser_task_environment.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "services/network/test/test_utils.h"
GetUploadData;
Return;
ReturnRef;
WarningSurface;
WarningAction;
WarningActionEvent;
DownloadWarningAction;
namespace safe_browsing {
namespace {
const char kTestDownloadUrl[] = …;
}
class SafeBrowsingServiceTest : public testing::Test { … };
TEST_F(SafeBrowsingServiceTest, SendDownloadReport_Success) { … }
TEST_F(
SafeBrowsingServiceTest,
SendDownloadReport_NoDownloadWarningActionWhenExtendedReportingDisabled) { … }
TEST_F(SafeBrowsingServiceTest,
WhenUserIsInSPAndNotPolicyOrSIncognitoReturnsTrue) { … }
TEST_F(SafeBrowsingServiceTest, WhenSPIsSetByPolicyReturnsFalse) { … }
TEST_F(SafeBrowsingServiceTest, WhenEPIsSetByPolicyReturnsFalse) { … }
TEST_F(SafeBrowsingServiceTest, WhenNoProtectionIsSetByPolicyReturnsFalse) { … }
TEST_F(SafeBrowsingServiceTest, WhenUserIsInEPNormallyReturnsFalse) { … }
TEST_F(SafeBrowsingServiceTest, WhenUserIsIncognitoReturnsFalse) { … }
TEST_F(SafeBrowsingServiceTest, WhenUserIsInNoProtectionNormallyoReturnsFalse) { … }
TEST_F(SafeBrowsingServiceTest,
SaveExtendedReportingPrefValueOnProfileAddedFeatureFlagEnabled) { … }
TEST_F(SafeBrowsingServiceTest,
SaveExtendedReportingPrefValueOnProfileAddedFeatureFlagDisabled) { … }
class SafeBrowsingServiceAntiPhishingTelemetryTest
: public SafeBrowsingServiceTest { … };
TEST_F(SafeBrowsingServiceAntiPhishingTelemetryTest,
SendPhishyInteractionsReport_Success) { … }
TEST_F(SafeBrowsingServiceAntiPhishingTelemetryTest,
WhenUserIsIncognitoDontSendReport) { … }
class SendNotificationsAcceptedTest : public SafeBrowsingServiceTest { … };
TEST_F(SendNotificationsAcceptedTest, SendReportForAllowlistedURL) { … }
TEST_F(SendNotificationsAcceptedTest,
DontSendReportForNonExtendedReportingUser) { … }
TEST_F(SendNotificationsAcceptedTest, DontSendReportWhenFeatureIsNotEnabled) { … }
TEST_F(SendNotificationsAcceptedTest, DontSendReportWhenUserIsIncognito) { … }
}