#include "chrome/browser/ui/extensions/extension_settings_overridden_dialog.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/ui_features.h"
#include "extensions/browser/disable_reason.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/manifest.h"
namespace {
DialogResult;
constexpr char kTestAcknowledgedPreference[] = …;
constexpr char kTestDialogResultHistogramName[] = …;
ExtensionSettingsOverriddenDialog::Params CreateTestDialogParams(
const extensions::ExtensionId& controlling_id) { … }
}
class ExtensionSettingsOverriddenDialogUnitTest
: public extensions::ExtensionServiceTestBase { … };
TEST_F(ExtensionSettingsOverriddenDialogUnitTest,
ShouldShowWithAControllingExtension) { … }
TEST_F(ExtensionSettingsOverriddenDialogUnitTest,
WontShowForAnAcknowledgedExtension) { … }
TEST_F(ExtensionSettingsOverriddenDialogUnitTest,
WontShowForAnExtensionThatCantBeDisabled) { … }
TEST_F(ExtensionSettingsOverriddenDialogUnitTest,
ExtensionDisabledOnDialogRejection) { … }
TEST_F(ExtensionSettingsOverriddenDialogUnitTest,
ExtensionAcknowledgedOnDialogAcceptance) { … }
TEST_F(ExtensionSettingsOverriddenDialogUnitTest,
ExtensionIsNeitherDisabledNorAcknowledgedOnDialogDismissal) { … }
TEST_F(
ExtensionSettingsOverriddenDialogUnitTest,
ExtensionIsNeitherDisabledNorAcknowledgedOnDialogCloseWithoutUserAction) { … }
TEST_F(ExtensionSettingsOverriddenDialogUnitTest,
WontShowTwiceForTheSameExtensionInTheSameSession) { … }
TEST_F(ExtensionSettingsOverriddenDialogUnitTest,
CanShowForDifferentExtensionsInTheSameSession) { … }
TEST_F(ExtensionSettingsOverriddenDialogUnitTest,
ExtensionRemovedWhileDialogShown) { … }
class LightweightExtensionSettingsOverriddenDialogTest
: public ExtensionSettingsOverriddenDialogUnitTest,
public testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(LightweightExtensionSettingsOverriddenDialogTest,
SimpleOverrideExtensionDoesntTriggerDialog) { … }
TEST_P(LightweightExtensionSettingsOverriddenDialogTest,
NonSimpleOverrideExtensionAlwaysTriggersDialog) { … }