FileDocCategorySizeDatePackage
HandlerTester.javaAPI DocAndroid 5.1 API2255Thu Mar 12 22:22:12 GMT 2015android.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;