n() {
        idle2Ran = true;
      });
      assert.lengthOf(pendingIdleCallbacks, 1);
      pendingIdleCallbacks.shift()();

      // Only the first idle callback should have run since there was no idle
      // time left.
      assert.isTrue(idle1Ran);
      assert.isFalse(idle2Ran);

      // Run the remaining idle task.
      assert.lengthOf(pendingIdleCallbacks, 1);
      pendingIdleCallbacks.shift()();
      assert.isTrue(idle2Ran);
    });
  });
});
</script>
