FileDocCategorySizeDatePackage
UnitTest.javaAPI DocAndroid 5.1 API3881Thu Mar 12 22:22:54 GMT 2015com.android.rs.test_compat

UnitTest

public class UnitTest extends Thread

Fields Summary
public String
name
private int
result
private ScriptField_ListAllocs_s.Item
mItem
private RSTestCore
mRSTC
private boolean
msgHandled
protected android.content.Context
mCtx
public static final int
RS_MSG_TEST_PASSED
public static final int
RS_MSG_TEST_FAILED
private static int
numTests
public int
testID
protected android.support.v8.renderscript.RenderScript.RSMessageHandler
mRsMessage
Constructors Summary
protected UnitTest(RSTestCore rstc, String n, int initResult, android.content.Context ctx)


             
        super();
        mRSTC = rstc;
        name = n;
        msgHandled = false;
        mCtx = ctx;
        result = initResult;
        testID = numTests++;
    
protected UnitTest(RSTestCore rstc, String n, android.content.Context ctx)

        this(rstc, n, 0, ctx);
    
protected UnitTest(RSTestCore rstc, android.content.Context ctx)

        this (rstc, "<Unknown>", ctx);
    
protected UnitTest(android.content.Context ctx)

        this (null, ctx);
    
Methods Summary
protected void_RS_ASSERT(java.lang.String message, boolean b)

        if(b == false) {
            Log.e(name, message + " FAILED");
            failTest();
        }
    
public voidfailTest()

        result = -1;
        updateUI();
    
public intgetResult()

        return result;
    
public voidpassTest()

        if (result != -1) {
            result = 1;
        }
        updateUI();
    
public voidrun()

        /* This method needs to be implemented for each subclass */
        if (mRSTC != null) {
            mRSTC.refreshTestResults();
        }
    
public voidsetItem(ScriptField_ListAllocs_s.Item item)

        mItem = item;
    
public java.lang.StringtoString()

        String out = name;
        if (result == 1) {
            out += " - PASSED";
        }
        else if (result == -1) {
            out += " - FAILED";
        }
        return out;
    
private voidupdateUI()

        if (mItem != null) {
            mItem.result = result;
            msgHandled = true;
            try {
                mRSTC.refreshTestResults();
            }
            catch (IllegalStateException e) {
                /* Ignore the case where our message receiver has been
                   disconnected. This happens when we leave the application
                   before it finishes running all of the unit tests. */
            }
        }
    
public voidwaitForMessage()


       
        while (!msgHandled) {
            yield();
        }