Search in sources :

Example 46 with SmallTest

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

the class SizeAdaptiveLayoutTest method testModestyPanelChangesColorWhite.

@SmallTest
public void testModestyPanelChangesColorWhite() {
    inflate(R.layout.size_adaptive_color);
    View panel = mSizeAdaptiveLayout.getModestyPanel();
    assertTrue("ModestyPanel should have a ColorDrawable background", panel.getBackground() instanceof ColorDrawable);
    ColorDrawable panelColor = (ColorDrawable) panel.getBackground();
    ColorDrawable salColor = (ColorDrawable) mSizeAdaptiveLayout.getBackground();
    assertEquals("ModestyPanel color should match the SizeAdaptiveLayout", panelColor.getColor(), salColor.getColor());
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) View(android.view.View) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 47 with SmallTest

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

the class BitwiseStreamsTest method testThree.

@SmallTest
public void testThree() throws Exception {
    int offset = 4;
    byte[] inBuf = HexDump.hexStringToByteArray("00031040900112488ea794e0");
    BitwiseOutputStream outStream = new BitwiseOutputStream(30);
    outStream.skip(offset);
    for (int i = 0; i < inBuf.length; i++) outStream.write(8, inBuf[i]);
    BitwiseInputStream inStream = new BitwiseInputStream(outStream.toByteArray());
    inStream.skip(offset);
    byte[] inBufDup = new byte[inBuf.length];
    for (int i = 0; i < inBufDup.length; i++) inBufDup[i] = (byte) inStream.read(8);
    assertEquals(HexDump.toHexString(inBuf), HexDump.toHexString(inBufDup));
}
Also used : BitwiseOutputStream(com.android.internal.util.BitwiseOutputStream) BitwiseInputStream(com.android.internal.util.BitwiseInputStream) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 48 with SmallTest

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

the class BitwiseStreamsTest method testExpandArray.

@SmallTest
public void testExpandArray() throws Exception {
    Random random = new Random();
    int iterations = 10000;
    int[] sizeArr = new int[iterations];
    int[] valueArr = new int[iterations];
    BitwiseOutputStream outStream = new BitwiseOutputStream(8);
    for (int i = 0; i < iterations; i++) {
        int x = random.nextInt();
        int size = (x & 0x07) + 1;
        int value = x & (-1 >>> (32 - size));
        sizeArr[i] = size;
        valueArr[i] = value;
        outStream.write(size, value);
    }
    BitwiseInputStream inStream = new BitwiseInputStream(outStream.toByteArray());
    for (int i = 0; i < iterations; i++) {
        assertEquals(valueArr[i], inStream.read(sizeArr[i]));
    }
}
Also used : BitwiseOutputStream(com.android.internal.util.BitwiseOutputStream) Random(java.util.Random) BitwiseInputStream(com.android.internal.util.BitwiseInputStream) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 49 with SmallTest

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

the class BitwiseStreamsTest method testFive.

@SmallTest
public void testFive() throws Exception {
    Random random = new Random();
    int iterations = 10000;
    int[] sizeArr = new int[iterations];
    int[] valueArr = new int[iterations];
    BitwiseOutputStream outStream = new BitwiseOutputStream(iterations * 4);
    for (int i = 0; i < iterations; i++) {
        int x = random.nextInt();
        int size = (x & 0x07) + 1;
        int value = x & (-1 >>> (32 - size));
        sizeArr[i] = size;
        valueArr[i] = value;
        outStream.write(size, value);
    }
    BitwiseInputStream inStream = new BitwiseInputStream(outStream.toByteArray());
    for (int i = 0; i < iterations; i++) {
        assertEquals(valueArr[i], inStream.read(sizeArr[i]));
    }
}
Also used : BitwiseOutputStream(com.android.internal.util.BitwiseOutputStream) Random(java.util.Random) BitwiseInputStream(com.android.internal.util.BitwiseInputStream) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 50 with SmallTest

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

the class StateMachineTest method testStateMachineQuit.

@SmallTest
public void testStateMachineQuit() throws Exception {
    if (WAIT_FOR_DEBUGGER)
        Debug.waitForDebugger();
    StateMachineQuitTest smQuitTest = new StateMachineQuitTest("smQuitTest");
    smQuitTest.start();
    if (smQuitTest.isDbg())
        tlog("testStateMachineQuit E");
    synchronized (smQuitTest) {
        // Send 6 message we'll quit on the first but all 6 should be processed before quitting.
        for (int i = 1; i <= 6; i++) {
            smQuitTest.sendMessage(smQuitTest.obtainMessage(i));
        }
        try {
            // wait for the messages to be handled
            smQuitTest.wait();
        } catch (InterruptedException e) {
            tloge("testStateMachineQuit: exception while waiting " + e.getMessage());
        }
    }
    dumpLogRecs(smQuitTest.mLogRecs);
    assertEquals(8, smQuitTest.mLogRecs.size());
    LogRec lr;
    Iterator<LogRec> itr = smQuitTest.mLogRecs.iterator();
    for (int i = 1; i <= 6; i++) {
        lr = itr.next();
        assertEquals(i, lr.getWhat());
        assertEquals(smQuitTest.mS1, lr.getState());
        assertEquals(smQuitTest.mS1, lr.getOriginalState());
    }
    lr = itr.next();
    assertEquals(EXIT, lr.getInfo());
    assertEquals(smQuitTest.mS1, lr.getState());
    lr = itr.next();
    assertEquals(ON_QUITTING, lr.getInfo());
    if (smQuitTest.isDbg())
        tlog("testStateMachineQuit X");
}
Also used : LogRec(com.android.internal.util.StateMachine.LogRec) 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