chromium/chrome/browser/extensions/mv2_deprecation_impact_checker_unittest.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/memory/raw_ptr.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/values_test_util.h"
#include "chrome/browser/extensions/extension_management_internal.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
#include "chrome/browser/extensions/manifest_v2_experiment_manager.h"
#include "chrome/browser/extensions/mv2_experiment_stage.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/test/base/testing_profile.h"
#include "components/sync_preferences/testing_pref_service_syncable.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"

namespace extensions {

namespace {

// Hashed ID for 'aaaa...a'.
constexpr char kTestHashedIdA[] =;
// Hashed ID for 'bbbb...b'.
constexpr char kTestHashedIdB[] =;

// The setting of the MV2 policy to use.
enum class MV2PolicyLevel {};

// A test variant that allows parameterization of both the experiment stage and
// the policy level.
TestVariant;

// Describes the current test variants; used in describing parameterized tests.
std::string DescribeTestVariant(const TestVariant& test_variant) {}

}  // namespace

class MV2DeprecationImpactCheckerUnitTest
    : public ExtensionServiceTestBase,
      public testing::WithParamInterface<TestVariant> {};

MV2DeprecationImpactCheckerUnitTest::MV2DeprecationImpactCheckerUnitTest()
    :{}

class MV2DeprecationImpactCheckerUnitTestWithAllowlist
    : public MV2DeprecationImpactCheckerUnitTest {};

INSTANTIATE_TEST_SUITE_P();

INSTANTIATE_TEST_SUITE_P();

// Tests that user-visible MV2 extensions are properly considered affected by
// the MV2 deprecation experiment.
TEST_P(MV2DeprecationImpactCheckerUnitTest,
       UserVisibleMV2ExtensionsAreAffected) {}

// Checks that certain special cases of extensions, such as default-installed
// and installed by OEM, are also affected by the MV2 deprecation experiments.
TEST_P(MV2DeprecationImpactCheckerUnitTest,
       DefaultInstalledMV2ExtensionsAreAffected) {}

// Tests that component extensions are not included in the MV2 deprecation
// experiment (they're implementation details of the browser).
TEST_P(MV2DeprecationImpactCheckerUnitTest, ComponentExtensionsAreNotAffected) {}

// Tests that MV3 extensions, of any location, are not affected by the MV2
// deprecation experiment.
TEST_P(MV2DeprecationImpactCheckerUnitTest, NoMV3ExtensionsAreAffected) {}

// Tests that MV2 policy-installed extensions are affected if and only if the
// policy does not exempt them.
TEST_P(MV2DeprecationImpactCheckerUnitTest,
       MV2PolicyInstalledExtensionsMayBeAffected) {}

// Tests that MV2 extensions that are allowed by policy, but not policy-
// installed, are treated as other MV2 extensions.
TEST_P(MV2DeprecationImpactCheckerUnitTest,
       MV2PolicyAllowedExtensionsMayBeAffected) {}

// Tests that any MV3 extension installed by policy is never affected by
// MV2 experiments.
TEST_P(MV2DeprecationImpactCheckerUnitTest,
       MV3PolicyInstalledExtensionsNeverAffected) {}

// Tests that non-extension "extension-like" things (such as platform apps and
// hosted apps) are not affected by the MV2 deprecation experiment.
TEST_P(MV2DeprecationImpactCheckerUnitTest, NonExtensionsAreNotAffected) {}

// Tests the allowlist is taken into account.
TEST_P(MV2DeprecationImpactCheckerUnitTestWithAllowlist, AllowlistWorks) {}

}  // namespace extensions