#include "components/payments/content/service_worker_payment_app_finder.h"
#include <algorithm>
#include <utility>
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/payments/payment_app_install_util.h"
#include "components/network_session_configurator/common/network_switches.h"
#include "components/payments/content/payment_manifest_web_data_service.h"
#include "components/payments/core/const_csp_checker.h"
#include "components/payments/core/features.h"
#include "components/payments/core/test_payment_manifest_downloader.h"
#include "components/permissions/permission_request_manager.h"
#include "components/webdata_services/web_data_service_wrapper_factory.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/re2/src/re2/re2.h"
#include "ui/gfx/image/image_unittest_util.h"
namespace payments {
namespace {
static const char kDefaultScope[] = …;
void GetAllInstalledPaymentAppsCallback(
base::OnceClosure done_callback,
content::InstalledPaymentAppsFinder::PaymentApps* out_apps,
content::InstalledPaymentAppsFinder::PaymentApps apps) { … }
}
class ServiceWorkerPaymentAppFinderBrowserTest : public InProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest, NoApps) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
UnknownMethod) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest, OwnOrigin) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
NotSupportedOrigin) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
OriginWildcardNotSupportedInPaymentMethodManifest) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
SupportedOrigin) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
TwoAppsSameMethod) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
TwoAppsDifferentMethods) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
InstallablePaymentApp) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
InvalidDifferentSiteRedirect) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
FourRedirectsIsNotValid) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
ThreeRedirectsIsValid) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
OneRedirectIsValid) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
CrossOriginHttpLinkHeaderIsInvalid) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
CrossOriginDefaultApplicationIsInvalid) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
CrossOriginServiceWorkerIsInvalid) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderBrowserTest,
CrossOriginServiceWorkerScopeIsInvalid) { … }
class ServiceWorkerPaymentAppFinderIconRefreshBrowserTest
: public ServiceWorkerPaymentAppFinderBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderIconRefreshBrowserTest,
PaymentAppUpdatesWhenIconChanges) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerPaymentAppFinderIconRefreshBrowserTest,
FailedIconFetchDoesNotOverrideOldIcon) { … }
class ServiceWorkerPaymentAppFinderCSPCheckerBrowserTest
: public ServiceWorkerPaymentAppFinderBrowserTest,
public ConstCSPChecker,
public testing::WithParamInterface<int> { … };
IN_PROC_BROWSER_TEST_P(ServiceWorkerPaymentAppFinderCSPCheckerBrowserTest,
CSPCheckerResetDoesNotCrash) { … }
IN_PROC_BROWSER_TEST_P(ServiceWorkerPaymentAppFinderCSPCheckerBrowserTest,
CSPCheckerResetDoesNotCrashWithTwoWebAppManifests) { … }
INSTANTIATE_TEST_SUITE_P(…);
}