#include "chrome/browser/download/download_ui_controller.h"
#include <memory>
#include <utility>
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/test/metrics/histogram_tester.h"
#include "chrome/browser/download/download_core_service_factory.h"
#include "chrome/browser/download/download_core_service_impl.h"
#include "chrome/browser/download/download_history.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "components/download/public/common/mock_download_item.h"
#include "components/history/core/browser/download_row.h"
#include "components/security_state/content/security_state_tab_helper.h"
#include "content/public/browser/download_item_utils.h"
#include "content/public/test/mock_download_manager.h"
#include "content/public/test/navigation_simulator.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
MockDownloadManager;
MockDownloadItem;
HistoryService;
_;
AnyNumber;
Assign;
Return;
ReturnRef;
ReturnRefOfCopy;
SaveArg;
namespace {
class TestDelegate : public DownloadUIController::Delegate { … };
TestDelegate::TestDelegate(
base::WeakPtr<raw_ptr<download::DownloadItem>> receiver)
: … { … }
void TestDelegate::OnNewDownloadReady(download::DownloadItem* item) { … }
class TestDownloadCoreService : public DownloadCoreServiceImpl { … };
TestDownloadCoreService::TestDownloadCoreService(Profile* profile)
: … { … }
TestDownloadCoreService::~TestDownloadCoreService() { … }
DownloadHistory* TestDownloadCoreService::GetDownloadHistory() { … }
class DownloadUIControllerTest : public ChromeRenderViewHostTestHarness { … };
std::unique_ptr<KeyedService>
DownloadUIControllerTest::TestingDownloadCoreServiceFactory(
content::BrowserContext* browser_context) { … }
DownloadUIControllerTest::DownloadUIControllerTest()
: … { … }
void DownloadUIControllerTest::SetUp() { … }
std::unique_ptr<MockDownloadItem>
DownloadUIControllerTest::CreateMockInProgressDownload() { … }
std::unique_ptr<DownloadUIController::Delegate>
DownloadUIControllerTest::GetTestDelegate() { … }
TEST_F(DownloadUIControllerTest, DownloadUIController_NotifyBasic) { … }
TEST_F(DownloadUIControllerTest, DownloadUIController_NotifyBasic_Interrupted) { … }
TEST_F(DownloadUIControllerTest, DownloadUIController_NotifyBasic_FileBlocked) { … }
TEST_F(DownloadUIControllerTest, DownloadUIController_NotifyReadyOnCreate) { … }
TEST_F(DownloadUIControllerTest, DownloadUIController_HistoryDownload) { … }
}