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

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

#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_browsertest_utils.h"
#include "chrome/browser/download/download_core_service.h"
#include "chrome/browser/download/download_core_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/toolbar/app_menu_model.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/interaction/interactive_browser_test.h"
#include "chrome/test/interaction/tracked_element_webcontents.h"
#include "chrome/test/interaction/webcontents_interaction_test_util.h"
#include "components/download/public/common/download_danger_type.h"
#include "components/safe_browsing/core/common/features.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/interaction/interaction_sequence.h"

namespace {

DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE();

const char kClickFn[] =;

Eq;

class DownloadsPageInteractiveUitest
    : public InteractiveBrowserTestT<DownloadTestBase> {};

IN_PROC_BROWSER_TEST_F(DownloadsPageInteractiveUitest, DownloadItemsAppear) {}

IN_PROC_BROWSER_TEST_F(DownloadsPageInteractiveUitest,
                       QuickRemoveDownloadItem) {}

IN_PROC_BROWSER_TEST_F(DownloadsPageInteractiveUitest, ClearAll) {}

// A test fixture in which a dangerous download returns the template parameter
// danger type.
template <download::DownloadDangerType DangerType>
class DownloadsPageInteractiveUitestWithDangerType
    : public DownloadsPageInteractiveUitest {};

template <download::DownloadDangerType DangerType>
class DownloadsPageInteractiveUitestWithDangerTypeForBypassDialog
    : public DownloadsPageInteractiveUitestWithDangerType<DangerType> {};

// Uncommon downloads follow the "suspicious" pattern and show up with grey
// icons and text. They can be validated from the page directly without a
// confirmation dialog.
DownloadsPageInteractiveUitestSuspicious;

IN_PROC_BROWSER_TEST_F(DownloadsPageInteractiveUitestSuspicious,
                       DiscardSuspiciousFile) {}

IN_PROC_BROWSER_TEST_F(DownloadsPageInteractiveUitestSuspicious,
                       QuickDiscardSuspiciousFile) {}

IN_PROC_BROWSER_TEST_F(DownloadsPageInteractiveUitestSuspicious,
                       ValidateSuspiciousFile) {}

// Dangerous downloads follow the "dangerous" pattern and show up with red
// icons and text. They can be validated only from the confirmation dialog.
DownloadsPageInteractiveUitestDangerous;

IN_PROC_BROWSER_TEST_F(DownloadsPageInteractiveUitestDangerous,
                       DiscardDangerousFile) {}

IN_PROC_BROWSER_TEST_F(DownloadsPageInteractiveUitestDangerous,
                       QuickDiscardDangerousFile) {}

// Dangerous downloads follow the "dangerous" pattern and show up with red
// icons and text. They can be validated only from the confirmation dialog.
DownloadsPageInteractiveUitestDangerousFromBypassDialog;

IN_PROC_BROWSER_TEST_F(DownloadsPageInteractiveUitestDangerousFromBypassDialog,
                       ValidateDangerousFileFromPrompt) {}

IN_PROC_BROWSER_TEST_F(DownloadsPageInteractiveUitestDangerousFromBypassDialog,
                       CancelValidateDangerousFile) {}

}  // namespace