#include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h"
#include <memory>
#include <ostream>
#include <string>
#include <string_view>
#include <utility>
#include "base/check.h"
#include "base/check_op.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/test_future.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/apps/app_service/browser_app_launcher.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/app_menu_model.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/browser/ui/web_applications/web_app_dialogs.h"
#include "chrome/browser/web_applications/commands/fetch_manifest_and_install_command.h"
#include "chrome/browser/web_applications/external_install_options.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.h"
#include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
#include "chrome/browser/web_applications/web_app_command_manager.h"
#include "chrome/browser/web_applications/web_app_command_scheduler.h"
#include "chrome/browser/web_applications/web_app_constants.h"
#include "chrome/browser/web_applications/web_app_install_finalizer.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "chrome/browser/web_applications/web_app_install_manager.h"
#include "chrome/browser/web_applications/web_app_install_params.h"
#include "chrome/browser/web_applications/web_app_install_utils.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "chrome/browser/web_applications/web_app_tab_helper.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/security_interstitials/content/security_interstitial_tab_helper.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"
#include "components/user_education/views/help_bubble_view.h"
#include "components/webapps/browser/install_result_code.h"
#include "components/webapps/browser/installable/installable_metrics.h"
#include "components/webapps/browser/test/service_worker_registration_waiter.h"
#include "components/webapps/browser/uninstall_result_code.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/models/menu_model.h"
#include "ui/base/page_transition_types.h"
#include "ui/base/window_open_disposition.h"
class GURL;
namespace base {
class FilePath;
}
namespace content {
class WebContents;
}
namespace web_app {
namespace {
void AutoAcceptDialogCallback(
content::WebContents* initiator_web_contents,
std::unique_ptr<WebAppInstallInfo> web_app_info,
WebAppInstallationAcceptanceCallback acceptance_callback) { … }
}
webapps::AppId InstallWebAppFromPage(Browser* browser, const GURL& app_url) { … }
webapps::AppId InstallWebAppFromPageAndCloseAppBrowser(Browser* browser,
const GURL& app_url) { … }
webapps::AppId InstallWebAppFromManifest(Browser* browser,
const GURL& app_url) { … }
Browser* LaunchWebAppBrowser(Profile* profile,
const webapps::AppId& app_id,
WindowOpenDisposition disposition) { … }
Browser* LaunchWebAppBrowserAndWait(Profile* profile,
const webapps::AppId& app_id,
WindowOpenDisposition disposition) { … }
Browser* LaunchBrowserForWebAppInTab(Profile* profile,
const webapps::AppId& app_id) { … }
Browser* LaunchWebAppToURL(Profile* profile,
const webapps::AppId& app_id,
const GURL& url) { … }
ExternalInstallOptions CreateInstallOptions(
const GURL& url,
const ExternalInstallSource& source) { … }
ExternallyManagedAppManager::InstallResult ExternallyManagedAppManagerInstall(
Profile* profile,
ExternalInstallOptions install_options) { … }
void NavigateViaLinkClickToURLAndWait(Browser* browser,
const GURL& url,
bool proceed_through_interstitial) { … }
void NavigateAndCheckForToolbar(Browser* browser,
const GURL& url,
bool expected_visibility,
bool proceed_through_interstitial) { … }
AppMenuCommandState GetAppMenuCommandState(int command_id, Browser* browser) { … }
Browser* FindWebAppBrowser(Profile* profile, const webapps::AppId& app_id) { … }
void CloseAndWait(Browser* browser) { … }
bool IsBrowserOpen(const Browser* test_browser) { … }
std::optional<webapps::AppId> ForceInstallWebApp(Profile* profile, GURL url) { … }
BrowserWaiter::BrowserWaiter(Browser* filter) : … { … }
BrowserWaiter::~BrowserWaiter() { … }
Browser* BrowserWaiter::AwaitAdded(const base::Location& location) { … }
Browser* BrowserWaiter::AwaitRemoved(const base::Location& location) { … }
void BrowserWaiter::OnBrowserAdded(Browser* browser) { … }
void BrowserWaiter::OnBrowserRemoved(Browser* browser) { … }
UpdateAwaiter::UpdateAwaiter(WebAppInstallManager& install_manager) { … }
void UpdateAwaiter::OnWebAppInstallManagerDestroyed() { … }
UpdateAwaiter::~UpdateAwaiter() = default;
void UpdateAwaiter::AwaitUpdate(const base::Location& location) { … }
void UpdateAwaiter::OnWebAppManifestUpdated(const webapps::AppId& app_id) { … }
base::FilePath CreateTestFileWithExtension(std::string_view extension) { … }
bool WaitForIPHToShowIfAny(Browser* browser) { … }
}