<!doctype html>
<title>Tests for step_wait</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
promise_test(async t => {
  let x = 1;
  Promise.resolve().then(() => ++x);
  await t.step_wait(() => x === 1);
  assert_equals(x, 2);
}, "Basic step_wait() test");

promise_test(async t => {
  let cond = false;
  let x = 0;
  setTimeout(() => cond = true, 100);
  await t.step_wait(() => {
    ++x;
    return cond;
  });
  assert