// TODO(tobyr) - Consider making this logic polymorphic which will remove
// instanceof test
//
// If this is not a benchmark, we have to create a fake trial run
if ( ! (outer instanceof com.google.gwt.junit.client.Benchmark) ) {
Trial trial = new Trial();
long testDurationMillis = System.currentTimeMillis() - testBeginMillis;
trial.setRunTimeMillis( testDurationMillis );
if (ex != null) {
ExceptionWrapper ew = new ExceptionWrapper(ex);
if (checkPoints != null) {
for (int i = 0, c = checkPoints.size(); i < c; ++i) {
ew.message += "\n" + checkPoints.get(i);
}
}
trial.setExceptionWrapper( ew );
}
trials.add( trial );
} else {
// If this was a benchmark, we need to handle exceptions specially
// If an exception occurred, it happened without the trial being recorded
// We, unfortunately, don't know the trial parameters at this point.
// We should consider putting the exception handling code directly into
// the generated Benchmark subclasses.
if (ex != null) {
ExceptionWrapper ew = new ExceptionWrapper(ex);
if (checkPoints != null) {
for (int i = 0, c = checkPoints.size(); i < c; ++i) {
ew.message += "\n" + checkPoints.get(i);
}
}
Trial trial = new Trial();
trial.setExceptionWrapper( ew );
trials.add( trial );
}
}
results.setSourceRef( getDocumentLocation() );