Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4e0b18c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove FakeSystemClock.setAutoIncrement."

parents f252a82e adb380a7
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -120,7 +120,6 @@ public class TileQueryHelperTest extends SysuiTestCase {
        ).when(mQSTileHost).createTile(anyString());

        FakeSystemClock clock = new FakeSystemClock();
        clock.setAutoIncrement(false);
        mMainExecutor = new FakeExecutor(clock);
        mBgExecutor = new FakeExecutor(clock);
        mTileQueryHelper = new TileQueryHelper(mContext, mMainExecutor, mBgExecutor);
+0 −1
Original line number Diff line number Diff line
@@ -690,7 +690,6 @@ public class NotifListBuilderImplTest extends SysuiTestCase {
        mListBuilder.addFilter(filter3);

        // GIVEN the SystemClock is set to a particular time:
        mSystemClock.setAutoIncrement(true);
        mSystemClock.setUptimeMillis(47);

        // WHEN the pipeline is kicked off on a list of notifs
+0 −6
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ public class FakeExecutorTest extends SysuiTestCase {
    @Test
    public void testNoDelay() {
        FakeSystemClock clock = new FakeSystemClock();
        clock.setAutoIncrement(false);
        FakeExecutor fakeExecutor = new FakeExecutor(clock);
        RunnableImpl runnable = new RunnableImpl();

@@ -99,7 +98,6 @@ public class FakeExecutorTest extends SysuiTestCase {
    @Test
    public void testDelayed() {
        FakeSystemClock clock = new FakeSystemClock();
        clock.setAutoIncrement(false);
        FakeExecutor fakeExecutor = new FakeExecutor(clock);
        RunnableImpl runnable = new RunnableImpl();

@@ -134,7 +132,6 @@ public class FakeExecutorTest extends SysuiTestCase {
    @Test
    public void testDelayed_AdvanceAndRun() {
        FakeSystemClock clock = new FakeSystemClock();
        clock.setAutoIncrement(false);
        FakeExecutor fakeExecutor = new FakeExecutor(clock);
        RunnableImpl runnable = new RunnableImpl();

@@ -181,7 +178,6 @@ public class FakeExecutorTest extends SysuiTestCase {
    @Test
    public void testExecutionOrder() {
        FakeSystemClock clock = new FakeSystemClock();
        clock.setAutoIncrement(false);
        FakeExecutor fakeExecutor = new FakeExecutor(clock);
        RunnableImpl runnableA = new RunnableImpl();
        RunnableImpl runnableB = new RunnableImpl();
@@ -251,7 +247,6 @@ public class FakeExecutorTest extends SysuiTestCase {
    @Test
    public void testRemoval_single() {
        FakeSystemClock clock = new FakeSystemClock();
        clock.setAutoIncrement(false);
        FakeExecutor fakeExecutor = new FakeExecutor(clock);
        RunnableImpl runnable = new RunnableImpl();
        Runnable removeFunction;
@@ -291,7 +286,6 @@ public class FakeExecutorTest extends SysuiTestCase {
    @Test
    public void testRemoval_multi() {
        FakeSystemClock clock = new FakeSystemClock();
        clock.setAutoIncrement(false);
        FakeExecutor fakeExecutor = new FakeExecutor(clock);
        List<Runnable> removeFunctions = new ArrayList<>();
        RunnableImpl runnable = new RunnableImpl();
+0 −25
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@ import java.util.ArrayList;
import java.util.List;

public class FakeSystemClock implements SystemClock {
    private boolean mAutoIncrement = true;

    private long mUptimeMillis;
    private long mElapsedRealtime;
    private long mElapsedRealtimeNanos;
@@ -34,54 +32,36 @@ public class FakeSystemClock implements SystemClock {
    @Override
    public long uptimeMillis() {
        long value = mUptimeMillis;
        if (mAutoIncrement) {
            setUptimeMillis(mUptimeMillis + 1);
        }
        return value;
    }

    @Override
    public long elapsedRealtime() {
        long value = mElapsedRealtime;
        if (mAutoIncrement) {
            setElapsedRealtime(mElapsedRealtime + 1);
        }
        return value;
    }

    @Override
    public long elapsedRealtimeNanos() {
        long value = mElapsedRealtimeNanos;
        if (mAutoIncrement) {
            setElapsedRealtimeNanos(mElapsedRealtimeNanos + 1);
        }
        return value;
    }

    @Override
    public long currentThreadTimeMillis() {
        long value = mCurrentThreadTimeMillis;
        if (mAutoIncrement) {
            setCurrentThreadTimeMillis(mCurrentThreadTimeMillis + 1);
        }
        return value;
    }

    @Override
    public long currentThreadTimeMicro() {
        long value = mCurrentThreadTimeMicro;
        if (mAutoIncrement) {
            setCurrentThreadTimeMicro(mCurrentThreadTimeMicro + 1);
        }
        return value;
    }

    @Override
    public long currentTimeMicro() {
        long value = mCurrentTimeMicro;
        if (mAutoIncrement) {
            setCurrentTimeMicro(mCurrentTimeMicro + 1);
        }
        return value;
    }

@@ -127,11 +107,6 @@ public class FakeSystemClock implements SystemClock {
        }
    }

    /** If true, each call to get____ will be one higher than the previous call to that method. */
    public void setAutoIncrement(boolean autoIncrement) {
        mAutoIncrement = autoIncrement;
    }

    public void addListener(ClockTickListener listener) {
        mListeners.add(listener);
    }