#include "chrome/browser/extensions/manifest_v2_experiment_manager.h"
#include "base/memory/raw_ptr.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/extension_management_internal.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_service_user_test_base.h"
#include "chrome/browser/extensions/mv2_experiment_stage.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/test/base/testing_profile.h"
#include "components/crx_file/id_util.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "extensions/browser/disable_reason.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/pref_names.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/mojom/manifest.mojom.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "components/account_id/account_id.h"
#include "components/user_manager/user.h"
#endif
namespace extensions {
class ManifestV2ExperimentManagerUnitTestBase
: public ExtensionServiceUserTestBase { … };
ManifestV2ExperimentManagerUnitTestBase::
ManifestV2ExperimentManagerUnitTestBase(
const std::vector<base::test::FeatureRef>& enabled_features,
const std::vector<base::test::FeatureRef>& disabled_features) { … }
class ManifestV2ExperimentManagerWarningUnitTest
: public ManifestV2ExperimentManagerUnitTestBase { … };
class ManifestV2ExperimentManagerDisabledUnitTest
: public ManifestV2ExperimentManagerUnitTestBase { … };
class ManifestV2ExperimentManagerDisableWithReEnableUnitTest
: public ManifestV2ExperimentManagerUnitTestBase { … };
class ManifestV2ExperimentManagerDisableWithReEnableAndWarningUnitTest
: public ManifestV2ExperimentManagerUnitTestBase { … };
TEST_F(ManifestV2ExperimentManagerWarningUnitTest,
ExperimentStageIsSetToWarning) { … }
TEST_F(ManifestV2ExperimentManagerWarningUnitTest, MV2ExtensionsAreAffected) { … }
TEST_F(ManifestV2ExperimentManagerWarningUnitTest,
MarkingNoticeAsAcknowledged) { … }
TEST_F(ManifestV2ExperimentManagerWarningUnitTest,
MarkingGlobalNoticeAsAcknowledged) { … }
TEST_F(ManifestV2ExperimentManagerDisabledUnitTest,
ExperimentStageIsSetToNone) { … }
TEST_F(ManifestV2ExperimentManagerDisabledUnitTest, NoExtensionsAreAffected) { … }
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableUnitTest,
ExperimentStageIsSetToDisableWithReEnable) { … }
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableAndWarningUnitTest,
ExperimentStageIsSetToDisableWithReEnable) { … }
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableUnitTest,
MV2ExtensionsAreAffected) { … }
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableUnitTest,
ShouldBlockInstallation_UserInstalledExtensions) { … }
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableUnitTest,
ShouldBlockInstallation_ComponentExtensions) { … }
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableUnitTest,
MarkingNoticeAsAcknowledged) { … }
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableUnitTest,
ProfileMetrics_ExtensionLocationsAreProperlyGrouped) { … }
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableUnitTest,
ProfileMetrics_MV3ExtensionsArentIncluded) { … }
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableUnitTest,
ProfileMetrics_UserReEnabledAreProperlyEmitted) { … }
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableUnitTest,
ProfileMetrics_ExtensionsThatAreDisabledForOtherReasonsEmitOther) { … }
enum class MV2PolicyLevel { … };
class ManifestV2ExperimentManagerDisableWithReEnableAndPolicyUnitTest
: public ManifestV2ExperimentManagerDisableWithReEnableUnitTest { … };
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableAndPolicyUnitTest,
ShouldBlockInstallation_DontBlockWhenAllMV2Allowed) { … }
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableAndPolicyUnitTest,
ShouldBlockInstallation_AllAreBlockedWhenMV2Disallowed) { … }
TEST_F(
ManifestV2ExperimentManagerDisableWithReEnableAndPolicyUnitTest,
ShouldBlockInstallation_UserInstalledAreBlockedWhenForceInstalledAllowed) { … }
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableAndPolicyUnitTest,
ExtensionsAreReEnabledOrDisabledOnPolicyChange) { … }
TEST_F(ManifestV2ExperimentManagerDisableWithReEnableAndPolicyUnitTest,
ProfileMetrics_ExtensionsAllowedByPolicyEmitUnaffected) { … }
}