#include <memory>
#include <optional>
#include <vector>
#include "base/auto_reset.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/metrics/user_action_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/mixin_based_extension_apitest.h"
#include "chrome/browser/extensions/webstore_installer.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ssl/https_upgrades_util.h"
#include "chrome/browser/supervised_user/supervised_user_extensions_delegate_impl.h"
#include "chrome/browser/supervised_user/supervised_user_test_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/extensions/extension_install_ui.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/supervised_user/parent_permission_dialog_view.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_test_util.h"
#include "chrome/test/supervised_user/supervision_mixin.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/supervised_user/core/common/features.h"
#include "components/supervised_user/core/common/pref_names.h"
#include "components/supervised_user/core/common/supervised_user_constants.h"
#include "content/public/browser/gpu_data_manager.h"
#include "content/public/test/browser_test.h"
#include "extensions/browser/allowlist_state.h"
#include "extensions/browser/api/management/management_api.h"
#include "extensions/browser/api_test_utils.h"
#include "extensions/browser/extension_dialog_auto_confirm.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/switches.h"
#include "gpu/config/gpu_feature_type.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "ui/gl/gl_switches.h"
#if BUILDFLAG(IS_CHROMEOS)
#include "chrome/browser/supervised_user/chromeos/parent_access_extension_approvals_manager.h"
#include "chromeos/crosapi/mojom/parent_access.mojom.h"
#endif
namespace extensions {
utils;
namespace {
constexpr char kExtensionId[] = …;
class WebstoreInstallListener : public WebstorePrivateApi::Delegate { … };
}
class ExtensionWebstorePrivateApiTest : public MixinBasedExtensionApiTest { … };
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallAccepted) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, MissingDownloadDir) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallLocalized) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallCancelled) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IncorrectManifest1) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IncorrectManifest2) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, AppInstallBubble) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IsInIncognitoMode) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IsNotInIncognitoMode) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IconUrl) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, BeginInstall) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallTheme) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, EmptyCrx) { … }
static constexpr char kTestAppId[] = …;
static constexpr char kTestAppVersion[] = …;
enum class SupervisedUserExtensionManagedBySwitch : int { … };
class SupervisedUserExtensionWebstorePrivateApiTest
: public ExtensionWebstorePrivateApiTest,
public ::testing::WithParamInterface<
SupervisedUserExtensionManagedBySwitch>,
#if BUILDFLAG(IS_CHROMEOS)
public TestExtensionApprovalsManagerObserver,
#endif
public TestParentPermissionDialogViewObserver { … };
IN_PROC_BROWSER_TEST_P(SupervisedUserExtensionWebstorePrivateApiTest,
ParentPermissionGranted) { … }
IN_PROC_BROWSER_TEST_P(SupervisedUserExtensionWebstorePrivateApiTest,
ParentPermissionCanceled) { … }
IN_PROC_BROWSER_TEST_P(SupervisedUserExtensionWebstorePrivateApiTest,
NoParentPermissionRequiredForTheme) { … }
IN_PROC_BROWSER_TEST_P(SupervisedUserExtensionWebstorePrivateApiTest,
InstallBlockedWhenPermissionsToggleOff) { … }
IN_PROC_BROWSER_TEST_P(SupervisedUserExtensionWebstorePrivateApiTest,
InstallSuccessfulWhenExtensionsToggleOn) { … }
INSTANTIATE_TEST_SUITE_P(…);
class ExtensionWebstoreGetWebGLStatusTest : public InProcessBrowserTest { … };
#if BUILDFLAG(IS_MAC)
#define MAYBE_Allowed …
#else
#define MAYBE_Allowed …
#endif
IN_PROC_BROWSER_TEST_F(ExtensionWebstoreGetWebGLStatusTest, MAYBE_Allowed) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstoreGetWebGLStatusTest, Blocked) { … }
class ExtensionWebstorePrivateGetReferrerChainApiTest
: public ExtensionWebstorePrivateApiTest { … };
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateGetReferrerChainApiTest,
GetReferrerChain) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateGetReferrerChainApiTest,
GetReferrerChainForNonSafeBrowsingUser) { … }
class ExtensionWebstorePrivateApiAllowlistEnforcementTest
: public ExtensionWebstorePrivateApiTest { … };
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiAllowlistEnforcementTest,
EnhancedSafeBrowsingNotAllowlisted) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiAllowlistEnforcementTest,
EnhancedSafeBrowsingAllowlisted) { … }
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiAllowlistEnforcementTest,
StandardSafeBrowsingNotAllowlisted) { … }
}