Skip to content

Commit

Permalink
LoAF: Separate iframe tests to 3 files
Browse files Browse the repository at this point in the history
This should avoid some timeouts

Bug: 1462683
Change-Id: Ic237cd58f88ae493818fd126795023ba3168e904
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5089347
Reviewed-by: Ian Clelland <[email protected]>
Commit-Queue: Noam Rosenthal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1233541}
  • Loading branch information
noamr authored and chromium-wpt-export-bot committed Dec 5, 2023
1 parent c0fdc02 commit fbcb310
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 23 deletions.
27 changes: 27 additions & 0 deletions long-animation-frame/tentative/loaf-iframe-crossorigin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Long Animation Frame Timing: iframes (cross-origin)</title>
<meta name="timeout" content="long">
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/common/utils.js"></script>
<script src="/common/dispatcher/dispatcher.js"></script>
<script src="resources/utils.js"></script>
<div id="log"></div>
<script>
const host_info = get_host_info();

for (const type of ["REMOTE_ORIGIN", "HTTP_NOTSAMESITE_ORIGIN"]) {
promise_test(async t => {
const [executor] = await prepare_exec_iframe(t, host_info[type]);
await expect_no_long_frame(() => executor.execute_script((duration) => {
const deadline = performance.now() + duration;
while (performance.now() < deadline) {}
}, [very_long_frame_duration]), t);
}, `A long busy wait in a ${type} iframe is not a long animation frame`);
}

</script>
</body>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Long Animation Frame Timing: iframes</title>
<title>Long Animation Frame Timing: iframes (same-origin)</title>
<meta name="timeout" content="long">
<body>
<script src="/resources/testharness.js"></script>
Expand All @@ -22,14 +22,6 @@
}, [very_long_frame_duration]), t);
}, 'A long busy wait without render in a same-origin iframe is not a long animation frame');

promise_test(async t => {
const [executor] = await prepare_exec_iframe(t, HTTP_NOTSAMESITE_ORIGIN);
await expect_no_long_frame(() => executor.execute_script((duration) => {
const deadline = performance.now() + duration;
while (performance.now() < deadline) {}
}, [very_long_frame_duration]), t);
}, 'A long busy wait in a cross-origin iframe is not a long animation frame');

promise_test(async t => {
const [executor] = await prepare_exec_iframe(t, ORIGIN);
await expect_long_frame(() => executor.execute_script(async (duration) => {
Expand All @@ -39,19 +31,5 @@
}, [very_long_frame_duration]), t);
}, 'A long busy wait in a same-origin requestAnimationFrame is a long animation frame');

for (const origin of ["ORIGIN", "REMOTE_ORIGIN", "HTTP_NOTSAMESITE_ORIGIN"]) {
promise_test(async t => {
const [executor] = await prepare_exec_iframe(t, host_info[origin]);
const entry = await executor.execute_script(async (duration) => {
const entryPromise = new Promise(resolve => new PerformanceObserver(list => {
resolve(list.getEntries(0));
}).observe({entryTypes: ["long-animation-frame"]}));
const deadline = performance.now() + duration;
while (performance.now() < deadline) {}
return entryPromise;
}, [very_long_frame_duration]);
}, `frames receive own long animation frames (${origin})`);
}

</script>
</body>
31 changes: 31 additions & 0 deletions long-animation-frame/tentative/loaf-iframe-self.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Long Animation Frame Timing: iframes (self)</title>
<meta name="timeout" content="long">
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/common/utils.js"></script>
<script src="/common/dispatcher/dispatcher.js"></script>
<script src="resources/utils.js"></script>
<div id="log"></div>
<script>
const host_info = get_host_info();

for (const origin of ["ORIGIN", "REMOTE_ORIGIN", "HTTP_NOTSAMESITE_ORIGIN"]) {
promise_test(async t => {
const [executor] = await prepare_exec_iframe(t, host_info[origin]);
const entry = await executor.execute_script(async (duration) => {
const entryPromise = new Promise(resolve => new PerformanceObserver(list => {
resolve(list.getEntries(0));
}).observe({entryTypes: ["long-animation-frame"]}));
const deadline = performance.now() + duration;
while (performance.now() < deadline) {}
return entryPromise;
}, [very_long_frame_duration]);
}, `frames receive own long animation frames (${origin})`);
}

</script>
</body>

0 comments on commit fbcb310

Please sign in to comment.