#include <memory>
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/browsertest_util.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/test/test_browser_dialog.h"
#include "chrome/browser/ui/views/extensions/extensions_toolbar_container.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.h"
#include "chrome/browser/web_applications/test/os_integration_test_override_impl.h"
#include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/disable_reason.h"
#include "extensions/browser/extension_dialog_auto_confirm.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_urls.h"
#include "ui/views/layout/animating_layout_manager_test_util.h"
#include "ui/views/test/widget_test.h"
namespace {
const char kUninstallUrl[] = …;
const char kReferrerId[] = …;
const char kUninstallUrlPrefKey[] = …;
scoped_refptr<const extensions::Extension> BuildTestExtension(
const char* extension_name = "foo") { … }
std::string GetActiveUrl(Browser* browser) { … }
void SetUninstallURL(extensions::ExtensionPrefs* prefs,
const std::string& extension_id) { … }
void CloseUninstallDialog(views::Widget* const bubble_widget) { … }
class TestExtensionUninstallDialogDelegate
: public extensions::ExtensionUninstallDialog::Delegate { … };
}
ExtensionUninstallDialogViewBrowserTest;
IN_PROC_BROWSER_TEST_F(ExtensionUninstallDialogViewBrowserTest,
TrackParentWindowDestruction) { … }
IN_PROC_BROWSER_TEST_F(ExtensionUninstallDialogViewBrowserTest,
TrackParentWindowDestructionAfterViewCreation) { … }
IN_PROC_BROWSER_TEST_F(ExtensionUninstallDialogViewBrowserTest,
ExtensionUninstalledWhileDialogIsActive) { … }
IN_PROC_BROWSER_TEST_F(ExtensionUninstallDialogViewBrowserTest,
WebAppWindowAshCrash) { … }
class ParameterizedExtensionUninstallDialogViewBrowserTest
: public InProcessBrowserTest,
public testing::WithParamInterface<extensions::UninstallReason> { … };
IN_PROC_BROWSER_TEST_P(ParameterizedExtensionUninstallDialogViewBrowserTest,
EnsureExtensionUninstallURLIsActiveTabAfterUninstall) { … }
IN_PROC_BROWSER_TEST_F(ExtensionUninstallDialogViewBrowserTest,
EnsureCWSReportAbusePageIsActiveTabAfterUninstall) { … }
IN_PROC_BROWSER_TEST_F(ExtensionUninstallDialogViewBrowserTest,
DialogAnchoredInCorrectPlace) { … }
class ExtensionUninstallDialogViewInteractiveBrowserTest
: public DialogBrowserTest { … };
#if BUILDFLAG(IS_WIN)
#define MAYBE_InvokeUi_ManualUninstall …
#else
#define MAYBE_InvokeUi_ManualUninstall …
#endif
IN_PROC_BROWSER_TEST_F(ExtensionUninstallDialogViewInteractiveBrowserTest,
MAYBE_InvokeUi_ManualUninstall) { … }
#if BUILDFLAG(IS_WIN)
#define MAYBE_InvokeUi_ManualUninstallShowReportAbuse …
#else
#define MAYBE_InvokeUi_ManualUninstallShowReportAbuse …
#endif
IN_PROC_BROWSER_TEST_F(ExtensionUninstallDialogViewInteractiveBrowserTest,
MAYBE_InvokeUi_ManualUninstallShowReportAbuse) { … }
#if BUILDFLAG(IS_WIN)
#define MAYBE_InvokeUi_UninstallByExtension …
#else
#define MAYBE_InvokeUi_UninstallByExtension …
#endif
IN_PROC_BROWSER_TEST_F(ExtensionUninstallDialogViewInteractiveBrowserTest,
MAYBE_InvokeUi_UninstallByExtension) { … }
#if BUILDFLAG(IS_WIN)
#define MAYBE_InvokeUi_UninstallByExtensionShowReportAbuse …
#else
#define MAYBE_InvokeUi_UninstallByExtensionShowReportAbuse …
#endif
IN_PROC_BROWSER_TEST_F(ExtensionUninstallDialogViewInteractiveBrowserTest,
MAYBE_InvokeUi_UninstallByExtensionShowReportAbuse) { … }
INSTANTIATE_TEST_SUITE_P(…);