FileDocCategorySizeDatePackage
HandlerTester.javaAPI DocAndroid 1.5 API2270Wed May 06 22:42:02 BST 2009com.android.unit_tests.os

HandlerTester

public abstract class HandlerTester extends Thread

Fields Summary
private boolean
mDone
private boolean
mSuccess
private android.os.Looper
mLooper
Constructors Summary
public HandlerTester()

    
Methods Summary
public voiddoTest(long timeout)

        start();

        synchronized (this) {
            try {
                wait(timeout);
                quit();
            }
            catch (InterruptedException e) {
            }
        }

        if (!mDone) {
            throw new RuntimeException("test timed out");
        }
        if (!mSuccess) {
            throw new RuntimeException("test failed");
        }
    
public voidfailure()

        mDone = true;
        mSuccess = false;
    
public abstract voidgo()

public abstract voidhandleMessage(android.os.Message msg)

private voidquit()

        mLooper.quit();
    
public voidrun()

        Looper.prepare();
        mLooper = Looper.myLooper();
        go();
        Looper.loop();
    
public voidsuccess()

        mDone = true;
        mSuccess = true;