Search in sources :

Example 6 with StringBuilderPrinter

use of android.util.StringBuilderPrinter in project android_frameworks_base by ResurrectionRemix.

the class BatteryStatsTimerTest method testLogState.

/**
     * Tests logState
     */
@SmallTest
public void testLogState() throws Exception {
    TimeBase timeBase = new TimeBase();
    MockClocks clocks = new MockClocks();
    TestTimer timer = new TestTimer(clocks, 0, timeBase);
    timer.setTotalTime(100);
    timer.setLoadedTime(200);
    timer.setLastTime(300);
    timer.setUnpluggedTime(400);
    timer.setTimeBeforeMark(500);
    timer.setCount(1);
    timer.setLoadedCount(2);
    timer.setLastCount(3);
    timer.setUnpluggedCount(4);
    timer.setTotalTime(9223372036854775807L);
    timer.setLoadedTime(9223372036854775806L);
    timer.setLastTime(9223372036854775805L);
    timer.setUnpluggedTime(9223372036854775804L);
    timer.setTimeBeforeMark(9223372036854775803L);
    StringBuilder sb = new StringBuilder();
    StringBuilderPrinter pw = new StringBuilderPrinter(sb);
    timer.logState(pw, "  ");
    Assert.assertEquals("  mCount=1 mLoadedCount=2 mLastCount=3 mUnpluggedCount=4\n" + "  mTotalTime=9223372036854775807 mLoadedTime=9223372036854775806\n" + "  mLastTime=9223372036854775805 mUnpluggedTime=9223372036854775804\n", sb.toString());
}
Also used : StringBuilderPrinter(android.util.StringBuilderPrinter) TimeBase(com.android.internal.os.BatteryStatsImpl.TimeBase) SmallTest(android.support.test.filters.SmallTest)

Example 7 with StringBuilderPrinter

use of android.util.StringBuilderPrinter in project android_frameworks_base by crdroidandroid.

the class BatteryStatsTimerTest method testLogState.

/**
     * Tests logState
     */
@SmallTest
public void testLogState() throws Exception {
    TimeBase timeBase = new TimeBase();
    MockClocks clocks = new MockClocks();
    TestTimer timer = new TestTimer(clocks, 0, timeBase);
    timer.setTotalTime(100);
    timer.setLoadedTime(200);
    timer.setLastTime(300);
    timer.setUnpluggedTime(400);
    timer.setTimeBeforeMark(500);
    timer.setCount(1);
    timer.setLoadedCount(2);
    timer.setLastCount(3);
    timer.setUnpluggedCount(4);
    timer.setTotalTime(9223372036854775807L);
    timer.setLoadedTime(9223372036854775806L);
    timer.setLastTime(9223372036854775805L);
    timer.setUnpluggedTime(9223372036854775804L);
    timer.setTimeBeforeMark(9223372036854775803L);
    StringBuilder sb = new StringBuilder();
    StringBuilderPrinter pw = new StringBuilderPrinter(sb);
    timer.logState(pw, "  ");
    Assert.assertEquals("  mCount=1 mLoadedCount=2 mLastCount=3 mUnpluggedCount=4\n" + "  mTotalTime=9223372036854775807 mLoadedTime=9223372036854775806\n" + "  mLastTime=9223372036854775805 mUnpluggedTime=9223372036854775804\n", sb.toString());
}
Also used : StringBuilderPrinter(android.util.StringBuilderPrinter) TimeBase(com.android.internal.os.BatteryStatsImpl.TimeBase) SmallTest(android.support.test.filters.SmallTest)

Aggregations

StringBuilderPrinter (android.util.StringBuilderPrinter)7 SmallTest (android.support.test.filters.SmallTest)5 TimeBase (com.android.internal.os.BatteryStatsImpl.TimeBase)5 Resources (android.content.res.Resources)1 Printer (android.util.Printer)1 ViewGroup (android.view.ViewGroup)1 EditorInfo (android.view.inputmethod.EditorInfo)1 InputConnection (android.view.inputmethod.InputConnection)1 Checkable (android.widget.Checkable)1 TextView (android.widget.TextView)1 ToStringHelper (com.google.common.base.Objects.ToStringHelper)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1