Commit ed5ec9b2 authored by Rouslan Solomakhin's avatar Rouslan Solomakhin Committed by Commit Bot

[Web Payment] Re-enable "load and remove iframe" tests.

Before this patch, macOS browser test for loading and removing iframe
with many payment requests sometimes timed out because the test created
4096 instances of PaymentRequest.

This patch reduces the number of PaymentRequest objects by 75% to 1024.

After this patch, macOS browser test for loading and removing iframe
with many payment requests should not timeout.

Bug: 1129573
Change-Id: Ibca3c55d68285edc85fb712337847951bba71aa1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2443937Reviewed-by: default avatarLiquan (Max) Gu <maxlg@chromium.org>
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813867}
parent 96bd9fd4
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "build/build_config.h" #include "base/test/scoped_feature_list.h"
#include "chrome/test/payments/payment_request_platform_browsertest_base.h" #include "chrome/test/payments/payment_request_platform_browsertest_base.h"
#include "components/payments/core/features.h"
#include "content/public/test/browser_test.h" #include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h" #include "content/public/test/browser_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -11,18 +12,21 @@ ...@@ -11,18 +12,21 @@
namespace payments { namespace payments {
namespace { namespace {
// TODO(crbug.com/1129573): fix flakiness and reenable class LoadAndRemoveIframeWithManyPaymentRequestsTest
#if defined(OS_MAC)
#define MAYBE_LoadAndRemoveIframeWithManyPaymentRequestsTest \
DISABLED_LoadAndRemoveIframeWithManyPaymentRequestsTest
#else
#define MAYBE_LoadAndRemoveIframeWithManyPaymentRequestsTest \
LoadAndRemoveIframeWithManyPaymentRequestsTest
#endif
class MAYBE_LoadAndRemoveIframeWithManyPaymentRequestsTest
: public PaymentRequestPlatformBrowserTestBase { : public PaymentRequestPlatformBrowserTestBase {
public: public:
LoadAndRemoveIframeWithManyPaymentRequestsTest() {
// Enable the browser-side feature flag as it's disabled by default on
// non-origin trial platforms.
feature_list_.InitAndEnableFeature(features::kSecurePaymentConfirmation);
}
void SetUpCommandLine(base::CommandLine* command_line) override {
PaymentRequestPlatformBrowserTestBase::SetUpCommandLine(command_line);
command_line->AppendSwitch(
switches::kEnableExperimentalWebPlatformFeatures);
}
void RunTest(const std::string& iframe_hostname) { void RunTest(const std::string& iframe_hostname) {
NavigateTo("a.com", "/load_and_remove_iframe.html"); NavigateTo("a.com", "/load_and_remove_iframe.html");
...@@ -36,14 +40,16 @@ class MAYBE_LoadAndRemoveIframeWithManyPaymentRequestsTest ...@@ -36,14 +40,16 @@ class MAYBE_LoadAndRemoveIframeWithManyPaymentRequestsTest
"/create_many_requests.html") "/create_many_requests.html")
.spec()))); .spec())));
} }
base::test::ScopedFeatureList feature_list_;
}; };
IN_PROC_BROWSER_TEST_F(MAYBE_LoadAndRemoveIframeWithManyPaymentRequestsTest, IN_PROC_BROWSER_TEST_F(LoadAndRemoveIframeWithManyPaymentRequestsTest,
CrossOriginNoCrash) { CrossOriginNoCrash) {
RunTest(/*iframe_hostname=*/"b.com"); RunTest(/*iframe_hostname=*/"b.com");
} }
IN_PROC_BROWSER_TEST_F(MAYBE_LoadAndRemoveIframeWithManyPaymentRequestsTest, IN_PROC_BROWSER_TEST_F(LoadAndRemoveIframeWithManyPaymentRequestsTest,
SameOriginNoCrash) { SameOriginNoCrash) {
RunTest(/*iframe_hostname=*/"a.com"); RunTest(/*iframe_hostname=*/"a.com");
} }
......
...@@ -17,6 +17,6 @@ const details = { ...@@ -17,6 +17,6 @@ const details = {
total: {label: 'Total', amount: {currency: 'USD', value: '55.00'}}, total: {label: 'Total', amount: {currency: 'USD', value: '55.00'}},
}; };
for (let i = 0; i < 0x1000; i++) { for (let i = 0; i < 0x400; i++) {
new PaymentRequest(supportedInstruments, details); new PaymentRequest(supportedInstruments, details);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment