chromium/chrome/browser/ui/views/extensions/extension_install_friction_dialog_view_browsertest.cc

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

#include <string>

#include "chrome/browser/ui/views/extensions/extension_install_friction_dialog_view.h"

#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/extensions_dialogs.h"
#include "chrome/browser/ui/tabs/tab_enums.h"
#include "chrome/browser/ui/test/test_browser_dialog.h"
#include "chrome/common/url_constants.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/test_utils.h"
#include "ui/views/test/widget_test.h"

namespace {

void CloseAndWait(views::Widget* widget) {}

}  // namespace

// Helper class to display the ExtensionInstallFrictionDialogView dialog for
// testing.
class ExtensionInstallFrictionDialogTest : public DialogBrowserTest {};

IN_PROC_BROWSER_TEST_F(ExtensionInstallFrictionDialogTest, InvokeUi_default) {}

class ExtensionInstallFrictionDialogViewTest
    : public extensions::ExtensionBrowserTest {};

// Regression test for https://crbug.com/1201031: Ensures that while an
// ExtensionInstallFrictionDialogView is visible, it does not (and cannot) refer
// to its originator tab/WebContents after the tab's closure.
IN_PROC_BROWSER_TEST_F(ExtensionInstallFrictionDialogViewTest,
                       TabClosureClearsWebContentsFromDialogView) {}