Merge "Remove FakeSystemClock.setAutoIncrement."

This commit is contained in:
TreeHugger Robot
2019-12-10 21:45:23 +00:00
committed by Android (Google) Code Review
4 changed files with 0 additions and 33 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -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();

View File

@@ -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);
}