ex[count++] = e;
}
});
// Set a timeout and an interval, both of which will throw a RuntimException.
getWindow().setTimeout(new TimeoutHandler() {
@Override
public void onTimeoutHandler() {
throw new RuntimeException("w00t!");
}
}, 1);
final int[] intervalHandle = new int[1];
intervalHandle[0] = getWindow().setInterval(new TimeoutHandler() {
@Override
public void onTimeoutHandler() {
// We only want this to happen once, so clear the interval timer on the
// first fire.
getWindow().clearInterval(intervalHandle[0]);
throw new RuntimeException("w00t!");
}
}, 1);
// Wait for the test to finish asynchronously, and setup another timer to
// check that the exceptions got caught (this is kind of ugly, but there's
// no way around it if we want to test the "real" timer implementation as
// opposed to a mock implementation.
delayTestFinish(5000);
getWindow().setTimeout(new TimeoutHandler() {
@Override
public void onTimeoutHandler() {
// Assert that exceptions got caught.
assertNotNull(ex[0]);
assertNotNull(ex[1]);