Methods Summary |
---|
public void | testOneShotFirst()
TestHandlerThread tester = new BaseTestHandler() {
int mCount;
public void go() {
super.go();
mCount = 0;
mHandler.sendMessageDelayed(mHandler.obtainMessage(0), 100);
addIdleHandler();
}
public void handleMessage(Message msg) {
if (msg.what == 0) {
mHandler.sendMessageDelayed(mHandler.obtainMessage(1), 100);
} else if (msg.what == 1) {
if (mCount == 1) {
success();
} else {
failure(new RuntimeException(
"Idle handler called " + mCount + " times"));
}
}
}
public boolean queueIdle() {
mCount++;
return false;
}
};
tester.doTest(1000);
|
public void | testOneShotLater()
TestHandlerThread tester = new BaseTestHandler() {
int mCount;
public void go() {
super.go();
mCount = 0;
mHandler.sendMessage(mHandler.obtainMessage(0));
}
public void handleMessage(Message msg) {
if (msg.what == 0) {
addIdleHandler();
mHandler.sendMessageDelayed(mHandler.obtainMessage(1), 100);
} else if (msg.what == 1) {
mHandler.sendMessageDelayed(mHandler.obtainMessage(2), 100);
} else if (msg.what == 2) {
if (mCount == 1) {
success();
} else {
failure(new RuntimeException(
"Idle handler called " + mCount + " times"));
}
}
}
public boolean queueIdle() {
mCount++;
return false;
}
};
tester.doTest(1000);
|
public void | testRepeatedFirst()
TestHandlerThread tester = new BaseTestHandler() {
int mCount;
public void go() {
super.go();
mCount = 0;
mHandler.sendMessageDelayed(mHandler.obtainMessage(0), 100);
addIdleHandler();
}
public void handleMessage(Message msg) {
if (msg.what == 0) {
mHandler.sendMessageDelayed(mHandler.obtainMessage(1), 100);
} else if (msg.what == 1) {
if (mCount == 2) {
success();
} else {
failure(new RuntimeException(
"Idle handler called " + mCount + " times"));
}
}
}
public boolean queueIdle() {
mCount++;
return true;
}
};
tester.doTest(1000);
|
public void | testRepeatedLater()
TestHandlerThread tester = new BaseTestHandler() {
int mCount;
public void go() {
super.go();
mCount = 0;
mHandler.sendMessage(mHandler.obtainMessage(0));
}
public void handleMessage(Message msg) {
if (msg.what == 0) {
addIdleHandler();
mHandler.sendMessageDelayed(mHandler.obtainMessage(1), 100);
} else if (msg.what == 1) {
mHandler.sendMessageDelayed(mHandler.obtainMessage(2), 100);
} else if (msg.what == 2) {
if (mCount == 2) {
success();
} else {
failure(new RuntimeException(
"Idle handler called " + mCount + " times"));
}
}
}
public boolean queueIdle() {
mCount++;
return true;
}
};
tester.doTest(1000);
|