final FrameworkPerfActivity activity = getActivity();
synchronized (activity.mResultNotifier) {
getInstrumentation().runOnMainSync(new Runnable() {
@Override
public void run() {
activity.startRunning();
}
});
try {
activity.mResultNotifier.wait(TEST_TIMEOUT);
} catch (InterruptedException e) {
fail("test interrupted.");
}
}
Bundle testResult = new Bundle();
synchronized (activity.mResults) {
assertTrue("test results were empty.", activity.mResults.size() > 0);
for (RunResult result : activity.mResults) {
testResult.putString(result.name, String.format("%f,%d,%d,%f,%d,%d",
result.getFgMsPerOp(), result.fgOps, result.fgTime,
result.getBgMsPerOp(), result.bgOps, result.bgTime));
}
}
getInstrumentation().sendStatus(Activity.RESULT_OK, testResult);