#include "chrome/browser/extensions/api/webstore_private/extension_install_status.h"
#include <vector>
#include "base/json/json_reader.h"
#include "base/json/values_util.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/extensions/extension_management_internal.h"
#include "chrome/browser/supervised_user/supervised_user_test_util.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "components/supervised_user/core/common/features.h"
#include "components/supervised_user/core/common/pref_names.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/extension_registry.h"
#include "extensions/browser/pref_names.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/manifest.h"
#include "extensions/common/permissions/permission_set.h"
APIPermissionID;
namespace extensions {
namespace {
constexpr char kExtensionId[] = …;
constexpr char kExtensionSettingsWithUpdateUrlBlocking[] = …;
constexpr char kExtensionSettingsWithWildcardBlocking[] = …;
constexpr char kExtensionSettingsWithIdBlocked[] = …;
}
class ExtensionInstallStatusTest : public BrowserWithTestWindowTest { … };
TEST_F(ExtensionInstallStatusTest, ExtensionEnabled) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionDisabled) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionInstalledButDisabledByPolicy) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionTerminated) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionBlocklisted) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionAllowed) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionForceInstalledByPolicy) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionBlockedByUpdateUrl) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionBlockedByWildcard) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionBlockedById) { … }
TEST_F(ExtensionInstallStatusTest,
ExtensionBlockByUpdateUrlWithRequestEnabled) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionBlockByWildcardWithRequestEnabled) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionBlockByIdWithRequestEnabled) { … }
TEST_F(ExtensionInstallStatusTest, PendingExtenisonIsWaitingToBeReviewed) { … }
TEST_F(ExtensionInstallStatusTest, PendingExtenisonIsApproved) { … }
TEST_F(ExtensionInstallStatusTest, PendingExtenisonIsRejected) { … }
TEST_F(ExtensionInstallStatusTest,
ExistingExtensionWithCustodianApprovalRequired) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionBlockedByManifestType) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionWithoutPermissionInfo) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionWithoutManifestInfo) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionBlockedByPermissions) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionBlockedByPermissionsWithUpdateUrl) { … }
TEST_F(ExtensionInstallStatusTest,
ExtensionBlockedByPermissionButAllowlistById) { … }
TEST_F(ExtensionInstallStatusTest, NonWebstoreUpdateUrlPolicy) { … }
TEST_F(ExtensionInstallStatusTest, ManifestVersionIsBlocked) { … }
TEST_F(ExtensionInstallStatusTest,
ManifestVersionIsBlockedWithExtensionRequest) { … }
TEST_F(ExtensionInstallStatusTest, ExtensionCorrupted) { … }
class SupervisedUserExtensionInstallStatusTest
: public ExtensionInstallStatusTest { … };
TEST_F(SupervisedUserExtensionInstallStatusTest,
NewExtensionWithCustodianApprovalRequiredForInstallation) { … }
TEST_F(
SupervisedUserExtensionInstallStatusTest,
NewExtensionOnSkipApprovalModeDoesNotRequireCustodianApprovalForInstallation) { … }
TEST_F(
SupervisedUserExtensionInstallStatusTest,
NewExtensionWithParentApprovalDoesNotRequireCustodianApprovalForInstallation) { … }
class ExtensionInstallStatusTestWithMV2Deprecation
: public ExtensionInstallStatusTest,
public testing::WithParamInterface<bool> { … };
ExtensionInstallStatusTestWithMV2DeprecationEnabled;
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(ExtensionInstallStatusTestWithMV2Deprecation,
MV2ExtensionsAreBlockedWithExperiment) { … }
TEST_P(ExtensionInstallStatusTestWithMV2DeprecationEnabled,
IdBlockedByPolicyTakesPriorityOverDeprecatedManifestVersion) { … }
TEST_P(ExtensionInstallStatusTestWithMV2DeprecationEnabled,
ManifestV2PolicyTakesPriorityOverDeprecatedManifestVersion) { … }
TEST_P(ExtensionInstallStatusTestWithMV2DeprecationEnabled,
EnabledTakesPriorityOverDeprecatedManifestVersion) { … }
TEST_P(ExtensionInstallStatusTestWithMV2DeprecationEnabled,
DeprecatedManifestVersionTakesPriorityOverDisabled) { … }
}