#include <ostream>
#include "base/base_paths.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/json/json_file_value_serializer.h"
#include "base/json/json_reader.h"
#include "base/memory/weak_ptr.h"
#include "base/path_service.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/current_thread.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_future.h"
#include "base/threading/scoped_blocking_call.h"
#include "base/threading/thread_restrictions.h"
#include "base/types/expected.h"
#include "chrome/browser/apps/app_service/app_registry_cache_waiter.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/link_capturing/link_capturing_feature_test_support.h"
#include "chrome/browser/notifications/notification_display_service_tester.h"
#include "chrome/browser/notifications/notification_permission_context.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/browser/ui/web_applications/web_app_browsertest_base.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.h"
#include "chrome/browser/web_applications/test/os_integration_test_override_impl.h"
#include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
#include "chrome/browser/web_applications/web_app_command_scheduler.h"
#include "chrome/browser/web_applications/web_app_install_info.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_registry_update.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"
#include "components/webapps/common/web_app_id.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_test.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 "net/test/embedded_test_server/embedded_test_server.h"
#include "third_party/blink/public/common/manifest/manifest.h"
#include "third_party/blink/public/mojom/manifest/manifest_launch_handler.mojom-shared.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "url/gurl.h"
namespace {
constexpr char kStartPageScopeA[] = …;
constexpr char kDestinationPageScopeA[] = …;
constexpr char kDestinationPageScopeB[] = …;
constexpr char kDestinationPageScopeX[] = …;
constexpr char kLinkCaptureTestInputPath[] = …;
constexpr char kValueScopeA2A[] = …;
constexpr char kValueScopeA2B[] = …;
constexpr char kValueScopeA2X[] = …;
constexpr char kValueLink[] = …;
constexpr char kValueButton[] = …;
constexpr char kValueServiceWorkerButton[] = …;
constexpr char kValueOpener[] = …;
constexpr char kValueNoOpener[] = …;
constexpr char kValueTargetSelf[] = …;
constexpr char kValueTargetFrame[] = …;
constexpr char kValueTargetBlank[] = …;
constexpr char kValueTargetNoFrame[] = …;
enum class LinkCapturing { … };
std::string_view ToParamString(LinkCapturing capturing) { … }
enum class StartingPoint { … };
std::string_view ToParamString(StartingPoint start) { … }
enum class Destination { … };
std::string ToIdString(Destination scope) { … }
std::string_view ToParamString(Destination scope) { … }
enum class RedirectType { … };
std::string ToIdString(RedirectType redirect, Destination final_destination) { … }
std::string_view ToParamString(RedirectType redirect) { … }
enum class NavigationElement { … };
std::string ToIdString(NavigationElement element) { … }
std::string_view ToParamString(NavigationElement element) { … }
enum class ClickMethod { … };
std::string_view ToParamString(ClickMethod click) { … }
enum class OpenerMode { … };
std::string ToIdString(OpenerMode opener) { … }
std::string ToParamString(
blink::mojom::ManifestLaunchHandler_ClientMode client_mode) { … }
std::string_view ToParamString(OpenerMode opener) { … }
template <typename ParamType, class Char, class Traits>
std::basic_ostream<Char, Traits>& operator<<(
std::basic_ostream<Char, Traits>& os,
ParamType param) { … }
enum class NavigationTarget { … };
std::string ToIdString(NavigationTarget target) { … }
std::string_view ToParamString(NavigationTarget target) { … }
LinkCaptureTestParam;
std::string LinkCaptureTestParamToString(
testing::TestParamInfo<LinkCaptureTestParam> param_info) { … }
std::string BrowserTypeToString(Browser::Type type) { … }
base::Value::Dict RenderFrameHostToJson(content::RenderFrameHost& rfh) { … }
base::Value::Dict WebContentsToJson(content::WebContents& web_contents) { … }
base::Value::Dict BrowserToJson(const Browser& browser) { … }
base::Value::Dict CaptureCurrentState() { … }
class WebContentsCreationMonitor : public ui_test_utils::AllTabsObserver { … };
}
class WebAppLinkCapturingParameterizedBrowserTest
: public web_app::WebAppBrowserTestBase,
public testing::WithParamInterface<LinkCaptureTestParam> { … };
#if BUILDFLAG(IS_CHROMEOS)
#define MAYBE_CheckLinkCaptureCombinations …
#else
#define MAYBE_CheckLinkCaptureCombinations …
#endif
IN_PROC_BROWSER_TEST_P(WebAppLinkCapturingParameterizedBrowserTest,
MAYBE_CheckLinkCaptureCombinations) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
#if BUILDFLAG(IS_CHROMEOS)
#define MAYBE_CleanupExpectations …
#else
#define MAYBE_CleanupExpectations …
#endif
WebAppLinkCapturingParameterizedExpectationTest;
IN_PROC_BROWSER_TEST_F(WebAppLinkCapturingParameterizedExpectationTest,
MAYBE_CleanupExpectations) { … }