summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/long-animation-frame/tentative/loaf-user-callback.html
blob: 3d868af87f3b7bb597b44fe78b1787deda003d3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Long Animation Frame Timing: basic</title>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/utils.js"></script>

<body>
<h1>Long Animation Frame: user callbacks</h1>
<div id="log"></div>
<script>

test_self_user_callback(t =>
    t.step_timeout(() => busy_wait()), "TimerHandler:setTimeout");

test_self_user_callback(() => {
    const interval = setInterval(() => {
        busy_wait();
        clearInterval(interval);
    }, 10);
}, "TimerHandler:setInterval");
test_self_user_callback(() =>
    requestAnimationFrame(() => busy_wait()), "FrameRequestCallback");

test_self_user_callback(t => {
    const element = document.createElement("div");
        document.body.appendChild(element);
        t.add_cleanup(() => element.remove());
        new ResizeObserver((entries, observer) => {
            busy_wait(very_long_frame_duration);
            observer.disconnect();
        }).observe(element);
}, "ResizeObserverCallback");

test_self_user_callback(t => {
    const element = document.createElement("div");
    element.innerText = "123";
    t.add_cleanup(() => element.remove());
    new IntersectionObserver((entries, observer) => {
        busy_wait(very_long_frame_duration);
        observer.disconnect();
    }).observe(element);
    document.body.appendChild(element);
}, "IntersectionObserverCallback");

test_self_user_callback(t =>
    scheduler.postTask(() => busy_wait()), "SchedulerPostTaskCallback");

  test_self_user_callback(t => {
    new PerformanceObserver(() => busy_wait()).observe(
      {type: "navigation", buffered: true});
}, "PerformanceObserverCallback");

</script>
</body>