summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/resources/test/tests/functional/step_wait_func.html
blob: 9fed18a3e20a1a484a73f05e47436f2166bb1e5b (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
<!doctype html>
<title>Tests for step_wait_func and step_wait_func_done</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
async_test(t => {
  let x = 0;
  let step_x = 0;
  setTimeout(() => ++x, 100);
  t.step_wait_func(() => {
    ++step_x;
    return x === 1;
  }, () => {
    assert_equals(step_x, 2);
    t.done();
  });
}, "Basic step_wait_func() test");

async_test(t => {
  let x = 0;
  setTimeout(() => ++x, 100);
  t.step_wait_func_done(() => true, () => assert_equals(x, 0));
}, "Basic step_wait_func_done() test");

</script>
<script type="text/json" id="expected">
{
  "summarized_status": {
    "message": null,
    "status_string": "OK"
  },
  "summarized_tests": [
    {
      "properties": {},
      "message": null,
      "name": "Basic step_wait_func() test",
      "status_string": "PASS"
    },
    {
      "properties": {},
      "message": null,
      "name": "Basic step_wait_func_done() test",
      "status_string": "PASS"
    }
  ],
  "type": "complete"
}
</script>