Methods Summary |
---|
public void | activityFinished(int resultCode, android.content.Intent data, java.lang.RuntimeException where)
finishWithResult(resultCode, data, where);
|
public void | addIntermediate(java.lang.String name)
if (mIntermediates != null) {
mIntermediates.addIntermediate(name);
}
|
public void | addIntermediate(java.lang.String name, long timeInNS)
if (mIntermediates != null) {
mIntermediates.addIntermediate(name, timeInNS);
}
|
public android.content.Intent | editIntent()
return mIntent;
|
public void | finishBad(java.lang.String error)
finishWithResult(Activity.RESULT_CANCELED, (new Intent()).setAction(error));
|
public void | finishGood()
finishWithResult(Activity.RESULT_OK, null);
|
public void | finishTiming(boolean realTime)
if (mIntermediates != null) {
mIntermediates.finishTiming(realTime);
}
|
public void | finishWithResult(int resultCode, android.content.Intent data)
RuntimeException where = new RuntimeException("Original error was here");
where.fillInStackTrace();
finishWithResult(resultCode, data, where);
|
public void | finishWithResult(int resultCode, android.content.Intent data, java.lang.RuntimeException where)
synchronized (this) {
//System.out.println("*** Activity finished!!");
mResultCode = resultCode;
mData = data;
mResultStack = where;
mFinished = true;
notifyAll();
}
|
public android.content.Context | getContext()
return mContext;
|
public int | getResultCode()
return mResultCode;
|
public android.content.Intent | getResultData()
return mData;
|
public java.lang.RuntimeException | getResultStack()
return mResultStack;
|
public boolean | isPerformanceOnly()
return false;
|
public void | onTimeout()
String msg = mExpecting == null
? "Timeout" : ("Timeout while expecting " + mExpecting);
finishWithResult(Activity.RESULT_CANCELED, (new Intent()).setAction(msg));
|
public int | runLaunchpad(java.lang.String action)
LaunchpadActivity.setCallingTest(this);
synchronized (this) {
mIntent.setAction(action);
mFinished = false;
//System.out.println("*** Starting: " + mIntent);
mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(mIntent);
}
return waitForResultOrThrow(60 * 1000);
|
public void | setInternalIterations(int count)
|
protected void | setUp()
super.setUp();
mIntent = new Intent(mContext, LaunchpadActivity.class);
mIntermediates = null;
|
public int | startPerformance(Intermediates intermediates)
mIntermediates = intermediates;
return 1;
|
public void | startTiming(boolean realTime)
if (mIntermediates != null) {
mIntermediates.startTiming(realTime);
}
|
protected void | tearDown()
mIntermediates = null;
super.tearDown();
|
public int | waitForResult(int timeoutMs, java.lang.String expected)
mExpecting = expected;
long endTime = System.currentTimeMillis() + timeoutMs;
boolean timeout = false;
synchronized (this) {
while (!mFinished) {
long delay = endTime - System.currentTimeMillis();
if (delay < 0) {
timeout = true;
break;
}
try {
wait(delay);
} catch (java.lang.InterruptedException e) {
// do nothing
}
}
}
mFinished = false;
if (timeout) {
mResultCode = Activity.RESULT_CANCELED;
onTimeout();
}
return mResultCode;
|
public int | waitForResultOrThrow(int timeoutMs)
return waitForResultOrThrow(timeoutMs, null);
|
public int | waitForResultOrThrow(int timeoutMs, java.lang.String expected)
int res = waitForResult(timeoutMs, expected);
if (res == Activity.RESULT_CANCELED) {
if (mResultStack != null) {
throw new RuntimeException(
mData != null ? mData.toString() : "Unable to launch",
mResultStack);
} else {
throw new RuntimeException(
mData != null ? mData.toString() : "Unable to launch");
}
}
return res;
|