Commit 74e4b2fc authored by arthursonzogni's avatar arthursonzogni Committed by Commit Bot

[COOP] access reporting: Use infinite timeout for receive.

Some browsers do not implement COOP reporting. As a result, no reports
are received after a 2.5s timeout.

Waiting 2.5s many time can reach the global timeout. Sometime, this
flakes in between FAIL and TIMEOUT.

This patch makes the timeout to be infinite by default to get consistent
failure.

Bug: 1090273
Change-Id: I081b9c8e944fc50b391753ce0948392b88d3fd0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2428976Reviewed-by: default avatarPâris Meuleman <pmeuleman@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810604}
parent 315e9703
......@@ -63,7 +63,6 @@ let runTest = (openee_redirect, name) => promise_test(async t => {
// 5. Check a report sent to the opener.
let report =
await receiveReport(opener_report_token, "access-from-coop-page-to-openee")
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.type, "coop");
assert_equals(report.url, opener_url.replace(/"/g, '%22'));
assert_equals(report.body.disposition, "reporting");
......
......@@ -64,7 +64,6 @@ let runTest = (openee_redirect, name) => promise_test(async t => {
// 5. Check a report sent to the opener.
let report =
await receiveReport(opener_report_token, "access-from-coop-page-to-openee")
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.type, "coop");
assert_equals(report.url, opener_url.replace(/"/g, '%22'));
assert_equals(report.body.disposition, "reporting");
......
......@@ -40,7 +40,6 @@ let runTest = (openee_redirect, name) => promise_test(async t => {
// 2. Check a report is sent to the openee.
let report =
await receiveReport(report_token, "access-from-coop-page-to-opener")
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.type, "coop");
assert_equals(report.url, openee_url.replace(/"/g, '%22'));
assert_equals(report.body.disposition, "reporting");
......
......@@ -41,7 +41,6 @@ let runTest = (openee_redirect, name) => promise_test(async t => {
// 2. Check a report is sent to the openee.
let report =
await receiveReport(report_token, "access-from-coop-page-to-opener")
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.type, "coop");
assert_equals(report.url, openee_url.replace(/"/g, '%22'));
assert_equals(report.body.disposition, "reporting");
......
......@@ -75,7 +75,6 @@ promise_test(async t => {
// 6. Check a report is sent to the openee.
let report =
await receiveReport(report_token, "access-from-coop-page-to-other")
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.type, "coop");
assert_equals(report.url, opener_url.replace(/"/g, '%22'));
assert_equals(report.body.disposition, "reporting");
......
......@@ -76,7 +76,6 @@ promise_test(async t => {
// 6. Check a report is sent to the openee.
let report =
await receiveReport(report_token, "access-from-coop-page-to-other")
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.type, "coop");
assert_equals(report.url, opener_url.replace(/"/g, '%22'));
assert_equals(report.body.disposition, "reporting");
......
......@@ -57,7 +57,6 @@ let runTest = (openee_redirect, name) => promise_test(async t => {
// 4. Check a report sent to the opener.
let report =
await receiveReport(opener_report_token, "access-to-coop-page-from-openee")
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.type, "coop");
assert_equals(report.url, opener_url.replace(/"/g, '%22'));
assert_equals(report.body.disposition, "reporting");
......
......@@ -58,7 +58,6 @@ let runTest = (openee_redirect, name) => promise_test(async t => {
// 4. Check a report sent to the opener.
let report =
await receiveReport(opener_report_token, "access-to-coop-page-from-openee")
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.type, "coop");
assert_equals(report.url, opener_url.replace(/"/g, '%22'));
assert_equals(report.body.disposition, "reporting");
......
......@@ -47,7 +47,6 @@ let runTest = (openee_redirect, name) => promise_test(async t => {
// 3. Check a report is sent to the openee.
let report =
await receiveReport(report_token, "access-to-coop-page-from-opener")
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.type, "coop");
assert_equals(report.url, openee_url.replace(/"/g, '%22'));
assert_equals(report.body.disposition, "reporting");
......
......@@ -48,7 +48,6 @@ let runTest = (openee_redirect, name) => promise_test(async t => {
// 3. Check a report is sent to the openee.
let report =
await receiveReport(report_token, "access-to-coop-page-from-opener")
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.type, "coop");
assert_equals(report.url, openee_url.replace(/"/g, '%22'));
assert_equals(report.body.disposition, "reporting");
......
......@@ -63,7 +63,6 @@ promise_test(async t => {
// 4. Check a report sent to the openee.
let report =
await receiveReport(openee_report_token, "access-to-coop-page-from-other")
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.type, "coop");
assert_equals(report.url, openee_url.replace(/"/g, '%22'));
assert_equals(report.body.disposition, "reporting");
......
......@@ -64,7 +64,6 @@ promise_test(async t => {
// 4. Check a report sent to the openee.
let report =
await receiveReport(openee_report_token, "access-to-coop-page-from-other")
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.type, "coop");
assert_equals(report.url, openee_url.replace(/"/g, '%22'));
assert_equals(report.body.disposition, "reporting");
......
......@@ -58,7 +58,6 @@ origin.forEach(([origin_name, origin]) => {
// 3. Check a reports is sent to the opener.
let report = await receiveReport(report_token, "access-to-coop-page")
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.body.property, property);
}, `${origin_name} > ${op}`);
......
......@@ -83,9 +83,6 @@ promise_test(async test => {
let report_openee =
await receiveReport(openee_report_token, "access-to-coop-page-from-opener")
assert_not_equals(report_openee, "timeout", "Report openee not received");
assert_not_equals(report_opener, "timeout", "Report opener not received");
assert_generic_coop_report(report_openee);
assert_generic_coop_report(report_opener);
......@@ -109,9 +106,6 @@ promise_test(async test => {
let report_openee =
await receiveReport(openee_report_token, "access-from-coop-page-to-opener")
assert_not_equals(report_openee, "timeout", "Report openee not received");
assert_not_equals(report_opener, "timeout", "Report opener not received");
assert_generic_coop_report(report_openee);
assert_generic_coop_report(report_opener);
......
......@@ -186,7 +186,6 @@ promise_test(async t => {
send(opener_iframe_token, `tryAccess(openee);`);
let reports = await receive(this_window_token);
assert_not_equals(reports, "timeout", "No report received.");
reports = JSON.parse(reports);
assert_equals(reports.length, 1, "No report received.");
assert_equals(reports[0].type, "coop-access-violation");
......@@ -248,7 +247,7 @@ promise_test(async t => {
// from the main document aren't notified.
send(opener_iframe_token, `tryAccess(openee);`);
let reports = await receive(this_window_token);
let reports = await receive(this_window_token, 2000);
assert_equals(reports, "timeout", "Unexpected report received.");
}, "Access from cross-site iframe")
......
......@@ -101,7 +101,6 @@ function redirect_test( popup_origin ) {
let report = await receiveReport(
opener_report_token,
"navigation-to-response");
assert_not_equals(report, "timeout", "Report not received");
assert_equals(report.type, "coop");
assert_equals(report.body.disposition, "enforce");
assert_equals(report.body.effectivePolicy, "same-origin-allow-popups");
......
......@@ -17,8 +17,8 @@ const send = function(uuid, message) {
});
}
const receive = async function(uuid) {
const timeout = 2500;
const receive = async function(uuid, maybe_timeout) {
const timeout = maybe_timeout || Infinity;
const retry_delay = 100;
for(let i = 0; i * retry_delay < timeout; ++i) {
let response = await fetch(dispatcher_url + `?uuid=${uuid}`);
......
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