chromium/chrome/browser/ui/download/download_bubble_security_view_info_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/ui/download/download_bubble_security_view_info.h"

#include "base/strings/pattern.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/download/bubble/download_bubble_prefs.h"
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_ui_model.h"
#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/test/base/testing_profile.h"
#include "components/download/public/common/mock_download_item.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/identity_test_utils.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "components/vector_icons/vector_icons.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"
#include "ui/views/vector_icons.h"

DownloadUIModelPtr;
TailoredVerdict;
DownloadItem;
NiceMock;
Return;
ReturnRefOfCopy;

class DownloadBubbleSecurityViewInfoTest
    : public ::testing::Test,
      public DownloadBubbleSecurityViewInfoObserver {};

// TODO: Remove the following test fixture once the ChromeRefresh flags are
//       removed or they're on by default.
class DownloadBubbleSecurityViewInfoTestGM3
    : public DownloadBubbleSecurityViewInfoTest {};

TEST_F(DownloadBubbleSecurityViewInfoTest, DangerousWarningInfo) {}

TEST_F(DownloadBubbleSecurityViewInfoTestGM3, InterruptedInfo) {}

#if BUILDFLAG(FULL_SAFE_BROWSING)
// Test file type warning where verdict was obtained.
TEST_F(DownloadBubbleSecurityViewInfoTest,
       FileTypeWarning_HasSafeBrowsingVerdict) {}

// Test file type warning where SB is on but no SB verdict was obtained.
TEST_F(DownloadBubbleSecurityViewInfoTest,
       FileTypeWarning_SafeBrowsingOn_NoVerdict) {}

// Test file type warning where SB is disabled by pref and can be turned on.
TEST_F(DownloadBubbleSecurityViewInfoTest,
       FileTypeWarning_NoSafeBrowsing_DisabledByPref) {}

// Test file type warning where SB is disabled by enterprise controls and cannot
// be turned on.
TEST_F(DownloadBubbleSecurityViewInfoTest,
       FileTypeWarning_NoSafeBrowsing_DisabledManaged) {}
#endif  // BUILDFLAG(FULL_SAFE_BROWSING)

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH)
class DownloadBubbleSecurityViewInfoTailoredWarningTest
    : public DownloadBubbleSecurityViewInfoTest {};

TEST_F(DownloadBubbleSecurityViewInfoTailoredWarningTest,
       GetInfoForTailoredWarning_CookieTheft) {}

TEST_F(DownloadBubbleSecurityViewInfoTailoredWarningTest,
       GetInfoForTailoredWarning_SuspiciousArchive) {}

TEST_F(DownloadBubbleSecurityViewInfoTailoredWarningTest,
       GetInfoForTailoredWarning_AccountInfoStringWithAccount) {}

TEST_F(DownloadBubbleSecurityViewInfoTailoredWarningTest,
       GetInfoForTailoredWarning_AccountInfoStringWithoutAccount) {}
#endif  // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH)