chromium/chrome/browser/ui/webui/downloads/downloads_list_tracker_unittest.cc

// Copyright 2015 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/webui/downloads/downloads_list_tracker.h"

#include <limits.h>
#include <stdint.h>

#include <memory>
#include <utility>
#include <vector>

#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/ui/webui/downloads/downloads.mojom.h"
#include "chrome/browser/ui/webui/downloads/mock_downloads_page.h"
#include "chrome/test/base/testing_profile.h"
#include "components/download/public/common/download_item.h"
#include "components/download/public/common/download_item_rename_handler.h"
#include "components/download/public/common/mock_download_item.h"
#include "content/public/browser/download_item_utils.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/mock_download_manager.h"
#include "content/public/test/test_web_ui.h"
#include "mojo/public/cpp/bindings/pending_remote.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"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "components/safe_browsing/core/common/proto/csd.pb.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"
#endif  // BUILDFLAG(FULL_SAFE_BROWSING)

DownloadItem;
MockDownloadItem;
SafeBrowsingState;
DownloadVector;
_;
Return;
ReturnRefOfCopy;
TailoredVerdict;

namespace {

bool ShouldShowItem(const DownloadItem& item) {}

class FakeRenameHandler : public download::DownloadItemRenameHandler {};

}  // namespace

// A test version of DownloadsListTracker.
class TestDownloadsListTracker : public DownloadsListTracker {};

// A fixture to test DownloadsListTracker.
class DownloadsListTrackerTest : public testing::Test {};

TEST_F(DownloadsListTrackerTest, SetSearchTerms) {}

MATCHER_P(MatchIds, expected, "") {}

TEST_F(DownloadsListTrackerTest, StartCallsInsertItems) {}

// The page is in a loading state until it gets an insertItems call. Ensure that
// happens even without downloads.
TEST_F(DownloadsListTrackerTest, EmptyGetAllItemsStillCallsInsertItems) {}

TEST_F(DownloadsListTrackerTest, OnDownloadCreatedCallsInsertItems) {}

TEST_F(DownloadsListTrackerTest, OnDownloadRemovedCallsRemoveItem) {}

TEST_F(DownloadsListTrackerTest, OnDownloadUpdatedCallsRemoveItem) {}

TEST_F(DownloadsListTrackerTest, StartExcludesHiddenItems) {}

TEST_F(DownloadsListTrackerTest, Incognito) {}

TEST_F(DownloadsListTrackerTest, OnlySendSomeItems) {}

TEST_F(DownloadsListTrackerTest, IgnoreUnsentItemUpdates) {}

TEST_F(DownloadsListTrackerTest, IgnoreUnsentItemRemovals) {}

TEST_F(DownloadsListTrackerTest, IgnoreTransientDownloads) {}

TEST_F(DownloadsListTrackerTest, NumDangerousItemsSent) {}

TEST_F(DownloadsListTrackerTest, GetFirstActiveWarningItem) {}

TEST_F(DownloadsListTrackerTest,
       CreateDownloadData_UrlFormatting_OmitUserPass) {}

TEST_F(DownloadsListTrackerTest, CreateDownloadData_UrlFormatting_Idn) {}

// URL longer than 16K but less than 2M.
TEST_F(DownloadsListTrackerTest, CreateDownloadData_UrlFormatting_Long) {}

// URL longer than 2M.
TEST_F(DownloadsListTrackerTest, CreateDownloadData_UrlFormatting_VeryLong) {}

TEST_F(DownloadsListTrackerTest, CreateDownloadData_ReferrerUrlPresent) {}

TEST_F(DownloadsListTrackerTest, CreateDownloadData_ReferrerUrlNotPresent) {}

TEST_F(DownloadsListTrackerTest,
       CreateDownloadData_ReferrerUrlFormatting_OmitUserPass) {}

TEST_F(DownloadsListTrackerTest, CreateDownloadData_ReferrerUrlFormatting_Idn) {}

// URL longer than 16K but less than 2M.
TEST_F(DownloadsListTrackerTest,
       CreateDownloadData_ReferrerUrlFormatting_Long) {}

// URL longer than 2M.
TEST_F(DownloadsListTrackerTest,
       CreateDownloadData_ReferrerUrlFormatting_VeryLong) {}

TEST_F(DownloadsListTrackerTest, RenamingProgress) {}

#if BUILDFLAG(FULL_SAFE_BROWSING)
TEST_F(DownloadsListTrackerTest, CreateDownloadData_SafeBrowsing) {}
#endif  // BUILDFLAG(FULL_SAFE_BROWSING)