Skip to content

Commit

Permalink
Fix Flaky WPT external/wpt/storage/partitioned-estimate-usage-details…
Browse files Browse the repository at this point in the history
…-caches.tentative.https.sub.html

Bug: 1407355
Change-Id: I7046d50d763c19049610ae7cfa5837903bb8f043
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4378219
Auto-Submit: Jonathan Njeunje <njeunje@chromium.org>
Reviewed-by: Ben Kelly <wanderview@chromium.org>
Commit-Queue: Ben Kelly <wanderview@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1123766}
  • Loading branch information
njeunje-g authored and chromium-wpt-export-bot committed Mar 29, 2023
1 parent d14a5dd commit 7765393
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,31 @@
`/resources/partitioned-estimate-usage-details-caches-helper-frame.html`
document.body.appendChild(iframe);


async_test(test => {
if (location.origin === alt_origin)
return;


let cache, cache_url;
test.step(async () => {
details.init = await usageDetails();
[cache, cache_url] = await createSomeUsage(test);
details.after = await usageDetails();
assert_greater_than(details.after, details.init);
window.addEventListener("message", test.step_func(async event => {
if (event.data === "iframe-is-ready") {
details.init = await usageDetails();
[cache, cache_url] = await createSomeUsage(test);
details.after = await usageDetails();
assert_greater_than(details.after, details.init);

iframe.contentWindow.postMessage("get-details", iframe.origin);
});
iframe.contentWindow.postMessage("get-details", iframe.origin);
}
}));

window.addEventListener("message", test.step_func(event => {
if (event.data.source === "same-site") {
details.same_site = event.data;

const cross_site_window = window
.open(`${alt_origin}${location.pathname}`, "", "noopener=false");

test.add_cleanup(() => cross_site_window.close());
}
if (event.data.source === "cross-site") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@
parent.opener.postMessage(details, parent.opener.origin);
}
});

window.parent.postMessage("iframe-is-ready", window.parent.origin);
</script>

0 comments on commit 7765393

Please sign in to comment.