chromium/chrome/browser/ui/views/extensions/mv2_disabled_dialog_controller_interactive_uitest.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 "base/files/file_util.h"
#include "base/path_service.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/chrome_test_extension_loader.h"
#include "chrome/browser/extensions/install_verifier.h"
#include "chrome/browser/extensions/manifest_v2_experiment_manager.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/browser_window/public/browser_window_features.h"
#include "chrome/browser/ui/extensions/mv2_disabled_dialog_controller.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/test/interaction/interactive_browser_test.h"
#include "content/public/test/browser_test.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/mojom/manifest.mojom-shared.h"
#include "extensions/test/test_extension_dir.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/widget/any_widget_observer.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_pref_names.h"
#include "ash/wm/window_restore/window_restore_util.h"
#endif

namespace extensions {

namespace {

DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE();

bool HasExtensionByName(std::string_view name, const ExtensionSet& extensions) {}

}  // namespace

class Mv2DisabledDialogControllerInteractiveUITest
    : public InteractiveBrowserTest {};

// Tests that extensions in disable dialog are uninstalled when the remove
// button is selected.
// Stage 1: Install an MV2 extension.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       PRE_PRE_OnRemoveSelected) {}
// Stage 2: Select the remove option in the disable dialog, which should
// uninstall the extension.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       PRE_OnRemoveSelected) {}
// Stage 3: Dialog is not shown again, since user acknowledged it.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       OnRemoveSelected) {}

// Tests that the extensions page is opened when the manage button is selected,
// and the extension is left disabled.
// Stage 1: Install an MV2 extension.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       PRE_PRE_OnManageSelected) {}
// Stage 2: Select the manage option in the disable dialog, which should open
// the extensions page.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       PRE_OnManageSelected) {}
// Stage 3: Dialog is not shown again, since user acknowledged it.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       OnManageSelected) {}

// Tests the dialog is shown again on new sessions if the user didn't take an
// action on the previous one (e.g dialog was closed for other reasons).
// Stage 1: Install an MV2 extension.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       PRE_PRE_NoUserAction) {}
// Stage 2: Take no action on the dialog.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       PRE_NoUserAction) {}
// Stage 3: Dialog is shown again, since user didn't take an action the previous
// time it was shown.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       NoUserAction) {}

// Tests that only MV2 disabled extensions that can be uninstalled are included
// in the dialog.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       PolicyInstalledExtensions) {}

// Tests that icons loaded asynchronously trigger the dialog after load is
// finished.
// Stage 1: Load an MV2 extension with an icon.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       PRE_IconsLoaded) {}
// Stage 2: Dialog should be visible and have icon.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       IconsLoaded) {}

// Tests that the correct extension info is passed to the dialog.
// Stage 1: Load two MV2 extensions.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       PRE_CorrectExtensionInfo) {}
// Stage 2: Verify extension info passed to dialog is correct.
IN_PROC_BROWSER_TEST_F(Mv2DisabledDialogControllerInteractiveUITest,
                       CorrectExtensionInfo) {}

}  // namespace extensions