#include "chrome/browser/download/download_warning_desktop_hats_utils.h"
#include <memory>
#include "base/files/file_path.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/download/download_item_warning_data.h"
#include "chrome/browser/ui/hats/hats_service.h"
#include "chrome/browser/ui/hats/hats_service_factory.h"
#include "chrome/browser/ui/hats/mock_hats_service.h"
#include "chrome/browser/ui/hats/survey_config.h"
#include "chrome/test/base/testing_profile.h"
#include "components/download/public/common/download_danger_type.h"
#include "components/download/public/common/download_item.h"
#include "components/download/public/common/mock_download_item.h"
#include "components/safe_browsing/buildflags.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_prefs.h"
#include "content/public/browser/download_item_utils.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(FULL_SAFE_BROWSING)
#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
#endif
namespace {
DownloadItem;
MockDownloadItem;
Fields;
_;
Eq;
HasSubstr;
Key;
NiceMock;
Not;
Return;
ReturnRefOfCopy;
UnorderedElementsAreArray;
constexpr char kUrl[] = …;
constexpr char kReferrerUrl[] = …;
constexpr char kPlaceholderPrefix[] = …;
const base::FilePath::CharType kFilename[] = …);
constexpr base::TimeDelta kIgnoreDelay = …;
MATCHER_P2(BitsDataMatches, field, matcher, "") { … }
MATCHER_P2(StringDataMatches, field, matcher, "") { … }
MATCHER_P(UnorderedKeysAre, fields, "") { … }
class DownloadWarningDesktopHatsUtilsTest : public ::testing::Test { … };
TEST_F(DownloadWarningDesktopHatsUtilsTest,
ProductSpecificData_NoSafeBrowsing) { … }
TEST_F(DownloadWarningDesktopHatsUtilsTest,
ProductSpecificData_StandardSafeBrowsing) { … }
TEST_F(DownloadWarningDesktopHatsUtilsTest,
ProductSpecificData_EnhancedSafeBrowsing) { … }
TEST_F(DownloadWarningDesktopHatsUtilsTest,
DelayedDownloadWarningHatsLauncher_LaunchesSurvey) { … }
TEST_F(DownloadWarningDesktopHatsUtilsTest,
DelayedDownloadWarningHatsLauncher_DoesntScheduleDuplicateSurvey) { … }
TEST_F(DownloadWarningDesktopHatsUtilsTest,
DelayedDownloadWarningHatsLauncher_MultipleSurveys) { … }
TEST_F(DownloadWarningDesktopHatsUtilsTest,
DelayedDownloadWarningHatsLauncher_WithholdsSurveyIfNoUserActivity) { … }
TEST_F(DownloadWarningDesktopHatsUtilsTest,
DelayedDownloadWarningHatsLauncher_DeletesTaskWhenItemDeleted) { … }
TEST_F(DownloadWarningDesktopHatsUtilsTest,
MaybeGetDownloadWarningHatsTrigger_FeatureDisabled) { … }
TEST_F(DownloadWarningDesktopHatsUtilsTest,
MaybeGetDownloadWarningHatsTrigger_ParamOutOfRange) { … }
TEST_F(DownloadWarningDesktopHatsUtilsTest,
MaybeGetDownloadWarningHatsTrigger_OnlyReturnsTriggerIfEligible) { … }
}