chromium/chrome/browser/download/download_warning_desktop_hats_utils_unittest.cc

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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 that checks for the presence of a particular bits data field and
// checks that the field value matches the given matcher.
MATCHER_P2(BitsDataMatches, field, matcher, "") {}

// As above, but for string data.
MATCHER_P2(StringDataMatches, field, matcher, "") {}

// Checks that the `fields` (vector of strings) exactly matches the keys in the
// `arg` (map of string->T).
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) {}

}  // namespace