#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_installation_manager.h"
#include <memory>
#include <optional>
#include <string_view>
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/callback.h"
#include "base/path_service.h"
#include "base/task/task_traits.h"
#include "base/test/gmock_expected_support.h"
#include "base/test/repeating_test_future.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "base/types/cxx23_to_underlying.h"
#include "base/types/expected.h"
#include "base/values.h"
#include "chrome/browser/policy/developer_tools_policy_handler.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_install_source.h"
#include "chrome/browser/web_applications/test/fake_web_app_provider.h"
#include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
#include "chrome/browser/web_applications/test/web_app_test.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/browser/web_applications/web_app_command_scheduler.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "components/keep_alive_registry/keep_alive_types.h"
#include "components/keep_alive_registry/scoped_keep_alive.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/testing_pref_service.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/common/content_features.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace web_app {
namespace {
ErrorIs;
HasValue;
ValueIs;
_;
Eq;
Field;
HasSubstr;
Optional;
Property;
VariantWith;
MATCHER_P(IsSameOriginWith, url, "") { … }
MaybeInstallIsolatedWebAppCommandSuccess;
MaybeIwaInstallSource;
class FakeWebAppCommandScheduler : public WebAppCommandScheduler { … };
class ScopedWorkingDirectoryWithFile { … };
base::CommandLine CreateCommandLine(
std::optional<std::string_view> proxy_flag_value,
std::optional<base::FilePath> bundle_flag_value) { … }
}
class IsolatedWebAppInstallationManagerTest : public WebAppTest { … };
TEST_F(IsolatedWebAppInstallationManagerTest,
NoInstallationWhenFeatureDisabled) { … }
TEST_F(IsolatedWebAppInstallationManagerTest,
NoInstallationWhenDevModeFeatureDisabled) { … }
TEST_F(IsolatedWebAppInstallationManagerTest,
InstallFromSecureRemoteProxySucceeds) { … }
TEST_F(IsolatedWebAppInstallationManagerTest,
InstallFromInsecureRemoteProxyFails) { … }
TEST_F(IsolatedWebAppInstallationManagerTest,
InstallFromHttpLocalhostProxySucceeds) { … }
TEST_F(IsolatedWebAppInstallationManagerTest,
InstallFromProxyWithBadSchemeFails) { … }
TEST_F(IsolatedWebAppInstallationManagerTest, InstallFromProxyWithPathFails) { … }
TEST_F(IsolatedWebAppInstallationManagerTest,
NoInstallationWhenDevModePolicyDisabled) { … }
class IsolatedWebAppInstallationManagerCommandLineTest
: public IsolatedWebAppInstallationManagerTest { … };
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
NoInstallationWhenProxyFlagAbsentAndBundleFlagAbsent) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
NoInstallationWhenProxyFlagAbsentAndBundleFlagEmpty) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
ErrorWhenProxyFlagAbsentAndBundleFlagInvalid) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
ErrorWhenProxyFlagAbsentAndBundleFlagIsDirectory) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
InstallsAppWhenProxyFlagAbsentAndBundleFlagValid) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
InstallsAppWhenProxyFlagAbsentAndBundleFlagValidAndAbsolute) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
NoInstallationWhenProxyFlagEmptyAndBundleFlagAbsent) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
NoInstallationWhenProxyFlagEmptyAndBundleFlagEmpty) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
ErrorWhenProxyFlagEmptyAndBundleFlagInvalid) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
InstallsAppWhenProxyFlagEmptyAndBundleFlagValid) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
ErrorWhenProxyFlagInvalidAndBundleFlagAbsent) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
ErrorWhenProxyFlagInvalidAndBundleFlagEmpty) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
ErrorWhenProxyFlagInvalidAndBundleFlagInvalid) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
ErrorWhenProxyFlagInvalidAndBundleFlagValid) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
InstallsAppWhenProxyFlagValidAndBundleFlagAbsent) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
InstallsAppWhenProxyFlagWithPortValidAndBundleFlagAbsent) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
ErrorWhenProxyFlagHasPathAndBundleFlagInValid) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
InstallsAppWhenProxyFlagValidAndBundleFlagEmpty) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
ErrorWhenProxyFlagValidAndBundleFlagInvalid) { … }
TEST_F(IsolatedWebAppInstallationManagerCommandLineTest,
ErrorWhenProxyFlagValidAndBundleFlagValid) { … }
}