Search in sources :

Example 51 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class StateMachineTest method testStateMachineQuitNow.

@SmallTest
public void testStateMachineQuitNow() throws Exception {
    if (WAIT_FOR_DEBUGGER)
        Debug.waitForDebugger();
    StateMachineQuitNowTest smQuitNowTest = new StateMachineQuitNowTest("smQuitNowTest");
    smQuitNowTest.start();
    if (smQuitNowTest.isDbg())
        tlog("testStateMachineQuitNow E");
    synchronized (smQuitNowTest) {
        // we send 6 only one will be processed.
        for (int i = 1; i <= 6; i++) {
            smQuitNowTest.sendMessage(smQuitNowTest.obtainMessage(i));
        }
        try {
            // wait for the messages to be handled
            smQuitNowTest.wait();
        } catch (InterruptedException e) {
            tloge("testStateMachineQuitNow: exception while waiting " + e.getMessage());
        }
    }
    tlog("testStateMachineQuiteNow: logRecs=" + smQuitNowTest.mLogRecs);
    assertEquals(3, smQuitNowTest.mLogRecs.size());
    Iterator<LogRec> itr = smQuitNowTest.mLogRecs.iterator();
    LogRec lr = itr.next();
    assertEquals(1, lr.getWhat());
    assertEquals(smQuitNowTest.mS1, lr.getState());
    assertEquals(smQuitNowTest.mS1, lr.getOriginalState());
    lr = itr.next();
    assertEquals(EXIT, lr.getInfo());
    assertEquals(smQuitNowTest.mS1, lr.getState());
    lr = itr.next();
    assertEquals(ON_QUITTING, lr.getInfo());
    if (smQuitNowTest.isDbg())
        tlog("testStateMachineQuitNow X");
}
Also used : LogRec(com.android.internal.util.StateMachine.LogRec) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 52 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class ColorStateListTest method testStateIsInList.

@SmallTest
public void testStateIsInList() throws Exception {
    ColorStateList colorStateList = mResources.getColorStateList(R.color.color1);
    int[] focusedState = { android.R.attr.state_focused };
    int focusColor = colorStateList.getColorForState(focusedState, R.color.failColor);
    assertEquals(mResources.getColor(R.color.testcolor1), focusColor);
}
Also used : ColorStateList(android.content.res.ColorStateList) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 53 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class ColorStateListTest method testEmptyState.

@SmallTest
public void testEmptyState() throws Exception {
    ColorStateList colorStateList = mResources.getColorStateList(R.color.color1);
    int[] emptyState = {};
    int defaultColor = colorStateList.getColorForState(emptyState, mFailureColor);
    assertEquals(mResources.getColor(R.color.testcolor2), defaultColor);
}
Also used : ColorStateList(android.content.res.ColorStateList) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 54 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class MediaPlayerMetadataParserTest method testGetDate.

// getDate
@SmallTest
public void testGetDate() throws Exception {
    writeDateRecord(Metadata.DATE, 0, "PST");
    adjustSize();
    assertParse();
    assertEquals(new Date(0), mMetadata.getDate(Metadata.DATE));
}
Also used : Date(java.util.Date) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 55 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ResurrectionRemix.

the class DatabaseLocaleTest method testHoge.

@SmallTest
public void testHoge() throws Exception {
    Cursor cursor = null;
    try {
        String expectedString = new String(new int[] { 0xFE000 }, 0, 1);
        mDatabase.execSQL("INSERT INTO test(id, data) VALUES(1, '" + expectedString + "')");
        cursor = mDatabase.rawQuery("SELECT data FROM test WHERE id = 1", null);
        assertNotNull(cursor);
        assertTrue(cursor.moveToFirst());
        String actualString = cursor.getString(0);
        assertEquals(expectedString.length(), actualString.length());
        for (int i = 0; i < expectedString.length(); i++) {
            assertEquals((int) expectedString.charAt(i), (int) actualString.charAt(i));
        }
        assertEquals(expectedString, actualString);
    } finally {
        if (cursor != null)
            cursor.close();
    }
}
Also used : Cursor(android.database.Cursor) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

SmallTest (android.test.suitebuilder.annotation.SmallTest)2108 Test (org.junit.Test)235 Parcel (android.os.Parcel)153 ArrayList (java.util.ArrayList)104 Time (android.text.format.Time)97 Rect (android.graphics.Rect)94 TelephonyTest (com.android.internal.telephony.TelephonyTest)84 Bundle (android.os.Bundle)77 ByteBuffer (java.nio.ByteBuffer)71 Intent (android.content.Intent)69 LinkProperties (android.net.LinkProperties)68 SpannableString (android.text.SpannableString)61 FlakyTest (android.support.test.filters.FlakyTest)58 DhcpPacket (android.net.dhcp.DhcpPacket)52 Rational (android.util.Rational)50 NetworkRequest (android.net.NetworkRequest)48 File (java.io.File)47 RouteInfo (android.net.RouteInfo)45 BitwiseOutputStream (com.android.internal.util.BitwiseOutputStream)45 ParcelUuid (android.os.ParcelUuid)43