<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Verify that requestAnimationFrame tasks can be properly tracked.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/task-ids.js"></script>
</head>
<body>
<script>
promise_test(() => {
return new Promise(async (resolve, reject) => {
const initialId = initializeTaskId();
await new Promise(resolve => setTimeout(resolve, 0));
requestAnimationFrame(() => {
try {
assert_equals(scheduler.taskId, initialId);
resolve();
} catch {
reject("Not an ancestor");
}
});
});
}, "A requestAnimationFrame callback is a descendant of the registering task");
promise_test(() => {
return new Promise(async (resolve, reject) => {
const initialId = initializeTaskId();
await new Promise(resolve => setTimeout(resolve, 0));
requestAnimationFrame(() => {
const intermediateId = scheduler.taskId;
requestAnimationFrame(() => {
try {
assert_equals(scheduler.taskId, initialId);
assert_equals(scheduler.taskId, intermediateId);
resolve();
} catch {
reject("Not an ancestor");
}
})
});
});
}, "Double requestAnimationFrame callback is a descendant of the registering"
+ " task");
</script>
</body>
</html>