summaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/com/android/server/telecom/tests/TelecomSystemTest.java')
-rw-r--r--tests/src/com/android/server/telecom/tests/TelecomSystemTest.java26
1 files changed, 21 insertions, 5 deletions
diff --git a/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java b/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
index 205d7788..e51a9c75 100644
--- a/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
+++ b/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
@@ -65,11 +65,10 @@ import com.android.internal.telecom.IInCallAdapter;
import com.android.server.telecom.AsyncRingtonePlayer;
import com.android.server.telecom.BluetoothPhoneServiceImpl;
import com.android.server.telecom.CallAudioManager;
-import com.android.server.telecom.CallAudioRouteStateMachine;
-import com.android.server.telecom.CallerInfoAsyncQueryFactory;
import com.android.server.telecom.CallerInfoLookupHelper;
import com.android.server.telecom.CallsManager;
import com.android.server.telecom.CallsManagerListenerBase;
+import com.android.server.telecom.ClockProxy;
import com.android.server.telecom.DefaultDialerCache;
import com.android.server.telecom.HeadsetMediaButton;
import com.android.server.telecom.HeadsetMediaButtonFactory;
@@ -83,7 +82,6 @@ import com.android.server.telecom.ProximitySensorManager;
import com.android.server.telecom.ProximitySensorManagerFactory;
import com.android.server.telecom.TelecomSystem;
import com.android.server.telecom.Timeouts;
-import com.android.server.telecom.callfiltering.AsyncBlockCheckFilter;
import com.android.server.telecom.components.UserCallIntentProcessor;
import com.android.server.telecom.ui.IncomingCallNotifier;
import com.android.server.telecom.ui.MissedCallNotifierImpl.MissedCallNotifierImplFactory;
@@ -108,6 +106,16 @@ public class TelecomSystemTest extends TelecomTestCase {
static final int TEST_POLL_INTERVAL = 10; // milliseconds
static final int TEST_TIMEOUT = 1000; // milliseconds
+ // Purposely keep the connect time (which is wall clock) and elapsed time (which is time since
+ // boot) different to test that wall clock time operations and elapsed time operations perform
+ // as they individually should.
+ static final long TEST_CREATE_TIME = 100;
+ static final long TEST_CREATE_ELAPSED_TIME = 200;
+ static final long TEST_CONNECT_TIME = 1000;
+ static final long TEST_CONNECT_ELAPSED_TIME = 2000;
+ static final long TEST_DISCONNECT_TIME = 8000;
+ static final long TEST_DISCONNECT_ELAPSED_TIME = 4000;
+
public class HeadsetMediaButtonFactoryF implements HeadsetMediaButtonFactory {
@Override
public HeadsetMediaButton create(Context context, CallsManager callsManager,
@@ -194,6 +202,7 @@ public class TelecomSystemTest extends TelecomTestCase {
@Mock BluetoothPhoneServiceImpl mBluetoothPhoneServiceImpl;
@Mock AsyncRingtonePlayer mAsyncRingtonePlayer;
@Mock IncomingCallNotifier mIncomingCallNotifier;
+ @Mock ClockProxy mClockProxy;
final ComponentName mInCallServiceComponentNameX =
new ComponentName(
@@ -393,7 +402,9 @@ public class TelecomSystemTest extends TelecomTestCase {
when(mTimeoutsAdapter.getCallScreeningTimeoutMillis(any(ContentResolver.class)))
.thenReturn(TEST_TIMEOUT / 5L);
mIncomingCallNotifier = mock(IncomingCallNotifier.class);
-
+ mClockProxy = mock(ClockProxy.class);
+ when(mClockProxy.currentTimeMillis()).thenReturn(TEST_CREATE_TIME);
+ when(mClockProxy.elapsedRealtime()).thenReturn(TEST_CREATE_ELAPSED_TIME);
mTelecomSystem = new TelecomSystem(
mComponentContextFixture.getTestDouble(),
new MissedCallNotifierImplFactory() {
@@ -426,7 +437,8 @@ public class TelecomSystemTest extends TelecomTestCase {
mAsyncRingtonePlayer,
mPhoneNumberUtilsAdapter,
mIncomingCallNotifier,
- (streamType, volume) -> mock(ToneGenerator.class));
+ (streamType, volume) -> mock(ToneGenerator.class),
+ mClockProxy);
mComponentContextFixture.setTelecomManager(new TelecomManager(
mComponentContextFixture.getTestDouble(),
@@ -891,6 +903,8 @@ public class TelecomSystemTest extends TelecomTestCase {
connectionServiceFixture.sendSetVideoState(ids.mConnectionId);
+ when(mClockProxy.currentTimeMillis()).thenReturn(TEST_CONNECT_TIME);
+ when(mClockProxy.elapsedRealtime()).thenReturn(TEST_CONNECT_ELAPSED_TIME);
connectionServiceFixture.sendSetActive(ids.mConnectionId);
assertEquals(Call.STATE_ACTIVE, mInCallServiceFixtureX.getCall(ids.mCallId).getState());
assertEquals(Call.STATE_ACTIVE, mInCallServiceFixtureY.getCall(ids.mCallId).getState());
@@ -928,6 +942,8 @@ public class TelecomSystemTest extends TelecomTestCase {
.answerVideo(eq(ids.mConnectionId), eq(videoState), any());
}
+ when(mClockProxy.currentTimeMillis()).thenReturn(TEST_CONNECT_TIME);
+ when(mClockProxy.elapsedRealtime()).thenReturn(TEST_CONNECT_ELAPSED_TIME);
connectionServiceFixture.sendSetActive(ids.mConnectionId);
assertEquals(Call.STATE_ACTIVE, mInCallServiceFixtureX.getCall(ids.mCallId).getState());
assertEquals(Call.STATE_ACTIVE, mInCallServiceFixtureY.getCall(ids.mCallId).getState());