Loading scripts/telecom_testing.sh +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ _lite_test_general() { build_dir="packages/services/Telecomm/tests" apk_loc="data/app/TelecomUnitTests/TelecomUnitTests.apk" package_prefix="com.android.server.telecom.tests" instrumentation="android.test.InstrumentationTestRunner";; instrumentation="android.support.test.runner.AndroidJUnitRunner";; "telephony") build_dir="frameworks/opt/telephony/tests/" apk_loc="data/app/FrameworksTelephonyTests/FrameworksTelephonyTests.apk" Loading tests/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ adb shell am instrument -w -e class com.android.server.telecom.tests.unit.FooUnitTest \ com.android.server.telecom.tests/android.test.InstrumentationTestRunner --> <instrumentation android:name="android.test.InstrumentationTestRunner" <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" android:targetPackage="com.android.server.telecom.tests" android:label="Telecomm application tests" android:debuggable="true"/> Loading tests/src/com/android/server/telecom/tests/AnalyticsTests.java +34 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,12 @@ import com.android.server.telecom.CallAudioRouteStateMachine; import com.android.server.telecom.LogUtils; import com.android.server.telecom.nano.TelecomLogClass; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.io.PrintWriter; import java.io.StringWriter; import java.util.Arrays; Loading @@ -53,13 +59,32 @@ import java.util.Set; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; @RunWith(JUnit4.class) public class AnalyticsTests extends TelecomSystemTest { @Override @Before public void setUp() throws Exception { super.setUp(); } @Override @After public void tearDown() throws Exception { super.tearDown(); } @MediumTest @Test public void testAnalyticsSingleCall() throws Exception { IdPair testCall = startAndMakeActiveIncomingCall( "650-555-1212", Loading Loading @@ -101,6 +126,7 @@ public class AnalyticsTests extends TelecomSystemTest { @FlakyTest @MediumTest @Test public void testAnalyticsDumping() throws Exception { Analytics.reset(); IdPair testCall = startAndMakeActiveIncomingCall( Loading Loading @@ -144,6 +170,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @MediumTest @Test public void testAnalyticsTwoCalls() throws Exception { IdPair testCall1 = startAndMakeActiveIncomingCall( "650-555-1212", Loading Loading @@ -196,6 +223,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @MediumTest @Test public void testAnalyticsVideo() throws Exception { Analytics.reset(); IdPair callIds = startAndMakeActiveOutgoingCall( Loading Loading @@ -245,6 +273,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @SmallTest @Test public void testAnalyticsRounding() { long[] testVals = {0, -1, -10, -100, -57836, 1, 10, 100, 1000, 458457}; long[] expected = {0, -1, -10, -100, -60000, 1, 10, 100, 1000, 500000}; Loading @@ -254,6 +283,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @SmallTest @Test public void testAnalyticsLogSessionTiming() throws Exception { long minTime = 50; Log.startSession(LogUtils.Sessions.CSW_ADD_CONFERENCE_CALL); Loading @@ -268,6 +298,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @MediumTest @Test public void testAnalyticsDumpToProto() throws Exception { Analytics.reset(); IdPair testCall = startAndMakeActiveIncomingCall( Loading Loading @@ -315,6 +346,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @MediumTest @Test public void testAnalyticsAudioRoutes() throws Exception { Analytics.reset(); IdPair testCall = startAndMakeActiveIncomingCall( Loading Loading @@ -355,6 +387,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @MediumTest @Test public void testAnalyticsConnectionProperties() throws Exception { Analytics.reset(); IdPair testCall = startAndMakeActiveIncomingCall( Loading Loading @@ -390,6 +423,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @SmallTest @Test public void testAnalyticsMaxSize() throws Exception { Analytics.reset(); for (int i = 0; i < Analytics.MAX_NUM_CALLS_TO_STORE * 2; i++) { Loading tests/src/com/android/server/telecom/tests/AsyncBlockCheckFilterTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,10 @@ import com.android.server.telecom.callfiltering.BlockCheckerAdapter; import com.android.server.telecom.callfiltering.CallFilterResultCallback; import com.android.server.telecom.callfiltering.CallFilteringResult; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.mockito.Mock; import java.util.concurrent.CountDownLatch; Loading @@ -37,6 +41,7 @@ import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @RunWith(JUnit4.class) public class AsyncBlockCheckFilterTest extends TelecomTestCase { @Mock private Context mContext; @Mock private BlockCheckerAdapter mBlockCheckerAdapter; Loading @@ -62,6 +67,7 @@ public class AsyncBlockCheckFilterTest extends TelecomTestCase { private static final int TEST_TIMEOUT = 100; @Override @Before public void setUp() throws Exception { super.setUp(); when(mCall.getHandle()).thenReturn(TEST_HANDLE); Loading @@ -69,6 +75,7 @@ public class AsyncBlockCheckFilterTest extends TelecomTestCase { } @SmallTest @Test public void testBlockNumber() { final CountDownLatch latch = new CountDownLatch(1); doAnswer(invocation -> { Loading @@ -83,6 +90,7 @@ public class AsyncBlockCheckFilterTest extends TelecomTestCase { } @SmallTest @Test public void testDontBlockNumber() { final CountDownLatch latch = new CountDownLatch(1); doAnswer(invocation -> { Loading tests/src/com/android/server/telecom/tests/BasicCallTests.java +60 −15 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ package com.android.server.telecom.tests; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyString; Loading Loading @@ -56,6 +60,11 @@ import com.android.internal.telephony.CallerInfo; import com.google.common.base.Predicate; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; Loading @@ -69,11 +78,25 @@ import org.mockito.ArgumentCaptor; /** * Performs various basic call tests in Telecom. */ @RunWith(JUnit4.class) public class BasicCallTests extends TelecomSystemTest { private static final String TEST_BUNDLE_KEY = "android.telecom.extra.TEST"; private static final String TEST_EVENT = "android.telecom.event.TEST"; @Override @Before public void setUp() throws Exception { super.setUp(); } @Override @After public void tearDown() throws Exception { super.tearDown(); } @LargeTest @Test public void testSingleOutgoingCallLocalDisconnect() throws Exception { IdPair ids = startAndMakeActiveOutgoingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading Loading @@ -102,6 +125,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testSingleOutgoingCallRemoteDisconnect() throws Exception { IdPair ids = startAndMakeActiveOutgoingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -123,6 +147,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testTelecomManagerAcceptRingingCall() throws Exception { IdPair ids = startIncomingPhoneCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -149,6 +174,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testTelecomManagerAcceptRingingVideoCall() throws Exception { IdPair ids = startIncomingPhoneCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), VideoProfile.STATE_BIDIRECTIONAL, mConnectionServiceFixtureA); Loading Loading @@ -177,6 +203,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testTelecomManagerAcceptRingingVideoCallAsAudio() throws Exception { IdPair ids = startIncomingPhoneCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), VideoProfile.STATE_BIDIRECTIONAL, mConnectionServiceFixtureA); Loading Loading @@ -204,6 +231,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testTelecomManagerAcceptRingingInvalidVideoState() throws Exception { IdPair ids = startIncomingPhoneCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), VideoProfile.STATE_BIDIRECTIONAL, mConnectionServiceFixtureA); Loading @@ -225,6 +253,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testSingleIncomingCallLocalDisconnect() throws Exception { IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -242,6 +271,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testSingleIncomingCallRemoteDisconnect() throws Exception { IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -256,6 +286,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testIncomingEmergencyCallback() throws Exception { // Make an outgoing emergency call String phoneNumber = "650-555-1212"; Loading @@ -279,15 +310,16 @@ public class BasicCallTests extends TelecomSystemTest { .createConnection(any(PhoneAccountHandle.class), anyString(), connectionRequestCaptor.capture(), eq(true), eq(false), any()); assert(connectionRequestCaptor.getValue().getExtras().containsKey( assertTrue(connectionRequestCaptor.getValue().getExtras().containsKey( android.telecom.Call.EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS)); assertTrue(connectionRequestCaptor.getValue().getExtras().getLong( android.telecom.Call.EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS, 0) > 0); assert(connectionRequestCaptor.getValue().getExtras().containsKey( assertTrue(connectionRequestCaptor.getValue().getExtras().containsKey( TelecomManager.EXTRA_INCOMING_CALL_ADDRESS)); } @LargeTest @Test public void testOutgoingCallAndSelectPhoneAccount() throws Exception { // Remove default PhoneAccount so that the Call moves into the correct // SELECT_PHONE_ACCOUNT state. Loading Loading @@ -317,6 +349,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testIncomingCallFromContactWithSendToVoicemailIsRejected() throws Exception { Bundle extras = new Bundle(); extras.putParcelable( Loading Loading @@ -359,6 +392,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testIncomingCallCallerInfoLookupTimesOutIsAllowed() throws Exception { when(mClockProxy.currentTimeMillis()).thenReturn(TEST_CREATE_TIME); when(mClockProxy.elapsedRealtime()).thenReturn(TEST_CREATE_ELAPSED_TIME); Loading Loading @@ -405,6 +439,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testIncomingCallFromBlockedNumberIsRejected() throws Exception { String phoneNumber = "650-555-1212"; blockNumber(phoneNumber); Loading Loading @@ -443,6 +478,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testIncomingCallBlockCheckTimesoutIsAllowed() throws Exception { final CountDownLatch latch = new CountDownLatch(1); String phoneNumber = "650-555-1212"; Loading Loading @@ -490,20 +526,8 @@ public class BasicCallTests extends TelecomSystemTest { }); } @MediumTest public void testDeadlockOnOutgoingCall() throws Exception { for (int i = 0; i < 100; i++) { BasicCallTests test = new BasicCallTests(); test.setContext(getContext()); test.setTestContext(getTestContext()); test.setName(getName()); test.setUp(); test.do_testDeadlockOnOutgoingCall(); test.tearDown(); } } @LargeTest @Test public void testIncomingThenOutgoingCalls() throws Exception { // TODO: We have to use the same PhoneAccount for both; see http://b/18461539 IdPair incoming = startAndMakeActiveIncomingCall("650-555-2323", Loading @@ -516,6 +540,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testOutgoingThenIncomingCalls() throws Exception { // TODO: We have to use the same PhoneAccount for both; see http://b/18461539 IdPair outgoing = startAndMakeActiveOutgoingCall("650-555-1212", Loading @@ -537,6 +562,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testAudioManagerOperations() throws Exception { AudioManager audioManager = (AudioManager) mComponentContextFixture.getTestDouble() .getApplicationContext().getSystemService(Context.AUDIO_SERVICE); Loading Loading @@ -598,11 +624,13 @@ public class BasicCallTests extends TelecomSystemTest { } @MediumTest @Test public void testBasicConferenceCall() throws Exception { makeConferenceCall(); } @MediumTest @Test public void testAddCallToConference1() throws Exception { ParcelableCall conferenceCall = makeConferenceCall(); IdPair callId3 = startAndMakeActiveOutgoingCall("650-555-1214", Loading @@ -620,6 +648,7 @@ public class BasicCallTests extends TelecomSystemTest { } @MediumTest @Test public void testAddCallToConference2() throws Exception { ParcelableCall conferenceCall = makeConferenceCall(); IdPair callId3 = startAndMakeActiveOutgoingCall("650-555-1214", Loading @@ -642,6 +671,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @MediumTest @Test public void testPullNonExternalCall() throws Exception { // TODO: Revisit this unit test once telecom support for filtering external calls from // InCall services is implemented. Loading @@ -662,6 +692,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @MediumTest @Test public void testSendConnectionEventNull() throws Exception { IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -677,6 +708,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @MediumTest @Test public void testSendConnectionEventNotNull() throws Exception { IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -698,6 +730,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @MediumTest @Test public void testSendCallEventNull() throws Exception { IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -714,6 +747,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @MediumTest @Test public void testSendCallEventNonNull() throws Exception { IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading Loading @@ -776,6 +810,7 @@ public class BasicCallTests extends TelecomSystemTest { * property set. */ @MediumTest @Test public void testCdmaEnhancedPrivacyVoiceCall() throws Exception { mConnectionServiceFixtureA.mConnectionServiceDelegate.mProperties = Connection.PROPERTY_HAS_CDMA_VOICE_PRIVACY; Loading @@ -794,6 +829,7 @@ public class BasicCallTests extends TelecomSystemTest { * when the Connection.PROPERTY_HAS_CDMA_VOICE_PRIVACY property is removed from the Connection. */ @MediumTest @Test public void testDropCdmaEnhancedPrivacyVoiceCall() throws Exception { mConnectionServiceFixtureA.mConnectionServiceDelegate.mProperties = Connection.PROPERTY_HAS_CDMA_VOICE_PRIVACY; Loading @@ -815,6 +851,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testPullExternalCall() throws Exception { // TODO: Revisit this unit test once telecom support for filtering external calls from // InCall services is implemented. Loading @@ -841,6 +878,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testPullNonPullableExternalCall() throws Exception { // TODO: Revisit this unit test once telecom support for filtering external calls from // InCall services is implemented. Loading @@ -864,6 +902,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testOutgoingCallSelectPhoneAccountVideo() throws Exception { startOutgoingPhoneCallPendingCreateConnection("650-555-1212", null, mConnectionServiceFixtureA, Loading @@ -886,6 +925,7 @@ public class BasicCallTests extends TelecomSystemTest { */ @FlakyTest @LargeTest @Test public void testOutgoingCallSelectPhoneAccountNoVideo() throws Exception { startOutgoingPhoneCallPendingCreateConnection("650-555-1212", null, mConnectionServiceFixtureA, Loading @@ -906,6 +946,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testSelfManagedOutgoing() throws Exception { PhoneAccountHandle phoneAccountHandle = mPhoneAccountSelfManaged.getAccountHandle(); IdPair ids = startAndMakeActiveOutgoingCall("650-555-1212", phoneAccountHandle, Loading @@ -920,6 +961,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testSelfManagedIncoming() throws Exception { PhoneAccountHandle phoneAccountHandle = mPhoneAccountSelfManaged.getAccountHandle(); IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", phoneAccountHandle, Loading @@ -935,6 +977,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testIsOutgoingCallPermitted() throws Exception { assertTrue(mTelecomSystem.getTelecomServiceImpl().getBinder() .isOutgoingCallPermitted(mPhoneAccountSelfManaged.getAccountHandle())); Loading @@ -946,6 +989,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testIsOutgoingCallPermittedOngoing() throws Exception { // Start a regular call; the self-managed CS can't make a call now. IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", Loading @@ -962,6 +1006,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testDisconnectSelfManaged() throws Exception { // Add a self-managed call. PhoneAccountHandle phoneAccountHandle = mPhoneAccountSelfManaged.getAccountHandle(); Loading Loading
scripts/telecom_testing.sh +1 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ _lite_test_general() { build_dir="packages/services/Telecomm/tests" apk_loc="data/app/TelecomUnitTests/TelecomUnitTests.apk" package_prefix="com.android.server.telecom.tests" instrumentation="android.test.InstrumentationTestRunner";; instrumentation="android.support.test.runner.AndroidJUnitRunner";; "telephony") build_dir="frameworks/opt/telephony/tests/" apk_loc="data/app/FrameworksTelephonyTests/FrameworksTelephonyTests.apk" Loading
tests/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ adb shell am instrument -w -e class com.android.server.telecom.tests.unit.FooUnitTest \ com.android.server.telecom.tests/android.test.InstrumentationTestRunner --> <instrumentation android:name="android.test.InstrumentationTestRunner" <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" android:targetPackage="com.android.server.telecom.tests" android:label="Telecomm application tests" android:debuggable="true"/> Loading
tests/src/com/android/server/telecom/tests/AnalyticsTests.java +34 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,12 @@ import com.android.server.telecom.CallAudioRouteStateMachine; import com.android.server.telecom.LogUtils; import com.android.server.telecom.nano.TelecomLogClass; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.io.PrintWriter; import java.io.StringWriter; import java.util.Arrays; Loading @@ -53,13 +59,32 @@ import java.util.Set; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; @RunWith(JUnit4.class) public class AnalyticsTests extends TelecomSystemTest { @Override @Before public void setUp() throws Exception { super.setUp(); } @Override @After public void tearDown() throws Exception { super.tearDown(); } @MediumTest @Test public void testAnalyticsSingleCall() throws Exception { IdPair testCall = startAndMakeActiveIncomingCall( "650-555-1212", Loading Loading @@ -101,6 +126,7 @@ public class AnalyticsTests extends TelecomSystemTest { @FlakyTest @MediumTest @Test public void testAnalyticsDumping() throws Exception { Analytics.reset(); IdPair testCall = startAndMakeActiveIncomingCall( Loading Loading @@ -144,6 +170,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @MediumTest @Test public void testAnalyticsTwoCalls() throws Exception { IdPair testCall1 = startAndMakeActiveIncomingCall( "650-555-1212", Loading Loading @@ -196,6 +223,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @MediumTest @Test public void testAnalyticsVideo() throws Exception { Analytics.reset(); IdPair callIds = startAndMakeActiveOutgoingCall( Loading Loading @@ -245,6 +273,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @SmallTest @Test public void testAnalyticsRounding() { long[] testVals = {0, -1, -10, -100, -57836, 1, 10, 100, 1000, 458457}; long[] expected = {0, -1, -10, -100, -60000, 1, 10, 100, 1000, 500000}; Loading @@ -254,6 +283,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @SmallTest @Test public void testAnalyticsLogSessionTiming() throws Exception { long minTime = 50; Log.startSession(LogUtils.Sessions.CSW_ADD_CONFERENCE_CALL); Loading @@ -268,6 +298,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @MediumTest @Test public void testAnalyticsDumpToProto() throws Exception { Analytics.reset(); IdPair testCall = startAndMakeActiveIncomingCall( Loading Loading @@ -315,6 +346,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @MediumTest @Test public void testAnalyticsAudioRoutes() throws Exception { Analytics.reset(); IdPair testCall = startAndMakeActiveIncomingCall( Loading Loading @@ -355,6 +387,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @MediumTest @Test public void testAnalyticsConnectionProperties() throws Exception { Analytics.reset(); IdPair testCall = startAndMakeActiveIncomingCall( Loading Loading @@ -390,6 +423,7 @@ public class AnalyticsTests extends TelecomSystemTest { } @SmallTest @Test public void testAnalyticsMaxSize() throws Exception { Analytics.reset(); for (int i = 0; i < Analytics.MAX_NUM_CALLS_TO_STORE * 2; i++) { Loading
tests/src/com/android/server/telecom/tests/AsyncBlockCheckFilterTest.java +8 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,10 @@ import com.android.server.telecom.callfiltering.BlockCheckerAdapter; import com.android.server.telecom.callfiltering.CallFilterResultCallback; import com.android.server.telecom.callfiltering.CallFilteringResult; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.mockito.Mock; import java.util.concurrent.CountDownLatch; Loading @@ -37,6 +41,7 @@ import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @RunWith(JUnit4.class) public class AsyncBlockCheckFilterTest extends TelecomTestCase { @Mock private Context mContext; @Mock private BlockCheckerAdapter mBlockCheckerAdapter; Loading @@ -62,6 +67,7 @@ public class AsyncBlockCheckFilterTest extends TelecomTestCase { private static final int TEST_TIMEOUT = 100; @Override @Before public void setUp() throws Exception { super.setUp(); when(mCall.getHandle()).thenReturn(TEST_HANDLE); Loading @@ -69,6 +75,7 @@ public class AsyncBlockCheckFilterTest extends TelecomTestCase { } @SmallTest @Test public void testBlockNumber() { final CountDownLatch latch = new CountDownLatch(1); doAnswer(invocation -> { Loading @@ -83,6 +90,7 @@ public class AsyncBlockCheckFilterTest extends TelecomTestCase { } @SmallTest @Test public void testDontBlockNumber() { final CountDownLatch latch = new CountDownLatch(1); doAnswer(invocation -> { Loading
tests/src/com/android/server/telecom/tests/BasicCallTests.java +60 −15 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ package com.android.server.telecom.tests; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyString; Loading Loading @@ -56,6 +60,11 @@ import com.android.internal.telephony.CallerInfo; import com.google.common.base.Predicate; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; Loading @@ -69,11 +78,25 @@ import org.mockito.ArgumentCaptor; /** * Performs various basic call tests in Telecom. */ @RunWith(JUnit4.class) public class BasicCallTests extends TelecomSystemTest { private static final String TEST_BUNDLE_KEY = "android.telecom.extra.TEST"; private static final String TEST_EVENT = "android.telecom.event.TEST"; @Override @Before public void setUp() throws Exception { super.setUp(); } @Override @After public void tearDown() throws Exception { super.tearDown(); } @LargeTest @Test public void testSingleOutgoingCallLocalDisconnect() throws Exception { IdPair ids = startAndMakeActiveOutgoingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading Loading @@ -102,6 +125,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testSingleOutgoingCallRemoteDisconnect() throws Exception { IdPair ids = startAndMakeActiveOutgoingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -123,6 +147,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testTelecomManagerAcceptRingingCall() throws Exception { IdPair ids = startIncomingPhoneCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -149,6 +174,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testTelecomManagerAcceptRingingVideoCall() throws Exception { IdPair ids = startIncomingPhoneCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), VideoProfile.STATE_BIDIRECTIONAL, mConnectionServiceFixtureA); Loading Loading @@ -177,6 +203,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testTelecomManagerAcceptRingingVideoCallAsAudio() throws Exception { IdPair ids = startIncomingPhoneCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), VideoProfile.STATE_BIDIRECTIONAL, mConnectionServiceFixtureA); Loading Loading @@ -204,6 +231,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testTelecomManagerAcceptRingingInvalidVideoState() throws Exception { IdPair ids = startIncomingPhoneCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), VideoProfile.STATE_BIDIRECTIONAL, mConnectionServiceFixtureA); Loading @@ -225,6 +253,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testSingleIncomingCallLocalDisconnect() throws Exception { IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -242,6 +271,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testSingleIncomingCallRemoteDisconnect() throws Exception { IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -256,6 +286,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testIncomingEmergencyCallback() throws Exception { // Make an outgoing emergency call String phoneNumber = "650-555-1212"; Loading @@ -279,15 +310,16 @@ public class BasicCallTests extends TelecomSystemTest { .createConnection(any(PhoneAccountHandle.class), anyString(), connectionRequestCaptor.capture(), eq(true), eq(false), any()); assert(connectionRequestCaptor.getValue().getExtras().containsKey( assertTrue(connectionRequestCaptor.getValue().getExtras().containsKey( android.telecom.Call.EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS)); assertTrue(connectionRequestCaptor.getValue().getExtras().getLong( android.telecom.Call.EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS, 0) > 0); assert(connectionRequestCaptor.getValue().getExtras().containsKey( assertTrue(connectionRequestCaptor.getValue().getExtras().containsKey( TelecomManager.EXTRA_INCOMING_CALL_ADDRESS)); } @LargeTest @Test public void testOutgoingCallAndSelectPhoneAccount() throws Exception { // Remove default PhoneAccount so that the Call moves into the correct // SELECT_PHONE_ACCOUNT state. Loading Loading @@ -317,6 +349,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testIncomingCallFromContactWithSendToVoicemailIsRejected() throws Exception { Bundle extras = new Bundle(); extras.putParcelable( Loading Loading @@ -359,6 +392,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testIncomingCallCallerInfoLookupTimesOutIsAllowed() throws Exception { when(mClockProxy.currentTimeMillis()).thenReturn(TEST_CREATE_TIME); when(mClockProxy.elapsedRealtime()).thenReturn(TEST_CREATE_ELAPSED_TIME); Loading Loading @@ -405,6 +439,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testIncomingCallFromBlockedNumberIsRejected() throws Exception { String phoneNumber = "650-555-1212"; blockNumber(phoneNumber); Loading Loading @@ -443,6 +478,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testIncomingCallBlockCheckTimesoutIsAllowed() throws Exception { final CountDownLatch latch = new CountDownLatch(1); String phoneNumber = "650-555-1212"; Loading Loading @@ -490,20 +526,8 @@ public class BasicCallTests extends TelecomSystemTest { }); } @MediumTest public void testDeadlockOnOutgoingCall() throws Exception { for (int i = 0; i < 100; i++) { BasicCallTests test = new BasicCallTests(); test.setContext(getContext()); test.setTestContext(getTestContext()); test.setName(getName()); test.setUp(); test.do_testDeadlockOnOutgoingCall(); test.tearDown(); } } @LargeTest @Test public void testIncomingThenOutgoingCalls() throws Exception { // TODO: We have to use the same PhoneAccount for both; see http://b/18461539 IdPair incoming = startAndMakeActiveIncomingCall("650-555-2323", Loading @@ -516,6 +540,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testOutgoingThenIncomingCalls() throws Exception { // TODO: We have to use the same PhoneAccount for both; see http://b/18461539 IdPair outgoing = startAndMakeActiveOutgoingCall("650-555-1212", Loading @@ -537,6 +562,7 @@ public class BasicCallTests extends TelecomSystemTest { } @LargeTest @Test public void testAudioManagerOperations() throws Exception { AudioManager audioManager = (AudioManager) mComponentContextFixture.getTestDouble() .getApplicationContext().getSystemService(Context.AUDIO_SERVICE); Loading Loading @@ -598,11 +624,13 @@ public class BasicCallTests extends TelecomSystemTest { } @MediumTest @Test public void testBasicConferenceCall() throws Exception { makeConferenceCall(); } @MediumTest @Test public void testAddCallToConference1() throws Exception { ParcelableCall conferenceCall = makeConferenceCall(); IdPair callId3 = startAndMakeActiveOutgoingCall("650-555-1214", Loading @@ -620,6 +648,7 @@ public class BasicCallTests extends TelecomSystemTest { } @MediumTest @Test public void testAddCallToConference2() throws Exception { ParcelableCall conferenceCall = makeConferenceCall(); IdPair callId3 = startAndMakeActiveOutgoingCall("650-555-1214", Loading @@ -642,6 +671,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @MediumTest @Test public void testPullNonExternalCall() throws Exception { // TODO: Revisit this unit test once telecom support for filtering external calls from // InCall services is implemented. Loading @@ -662,6 +692,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @MediumTest @Test public void testSendConnectionEventNull() throws Exception { IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -677,6 +708,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @MediumTest @Test public void testSendConnectionEventNotNull() throws Exception { IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -698,6 +730,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @MediumTest @Test public void testSendCallEventNull() throws Exception { IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading @@ -714,6 +747,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @MediumTest @Test public void testSendCallEventNonNull() throws Exception { IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Loading Loading @@ -776,6 +810,7 @@ public class BasicCallTests extends TelecomSystemTest { * property set. */ @MediumTest @Test public void testCdmaEnhancedPrivacyVoiceCall() throws Exception { mConnectionServiceFixtureA.mConnectionServiceDelegate.mProperties = Connection.PROPERTY_HAS_CDMA_VOICE_PRIVACY; Loading @@ -794,6 +829,7 @@ public class BasicCallTests extends TelecomSystemTest { * when the Connection.PROPERTY_HAS_CDMA_VOICE_PRIVACY property is removed from the Connection. */ @MediumTest @Test public void testDropCdmaEnhancedPrivacyVoiceCall() throws Exception { mConnectionServiceFixtureA.mConnectionServiceDelegate.mProperties = Connection.PROPERTY_HAS_CDMA_VOICE_PRIVACY; Loading @@ -815,6 +851,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testPullExternalCall() throws Exception { // TODO: Revisit this unit test once telecom support for filtering external calls from // InCall services is implemented. Loading @@ -841,6 +878,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testPullNonPullableExternalCall() throws Exception { // TODO: Revisit this unit test once telecom support for filtering external calls from // InCall services is implemented. Loading @@ -864,6 +902,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testOutgoingCallSelectPhoneAccountVideo() throws Exception { startOutgoingPhoneCallPendingCreateConnection("650-555-1212", null, mConnectionServiceFixtureA, Loading @@ -886,6 +925,7 @@ public class BasicCallTests extends TelecomSystemTest { */ @FlakyTest @LargeTest @Test public void testOutgoingCallSelectPhoneAccountNoVideo() throws Exception { startOutgoingPhoneCallPendingCreateConnection("650-555-1212", null, mConnectionServiceFixtureA, Loading @@ -906,6 +946,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testSelfManagedOutgoing() throws Exception { PhoneAccountHandle phoneAccountHandle = mPhoneAccountSelfManaged.getAccountHandle(); IdPair ids = startAndMakeActiveOutgoingCall("650-555-1212", phoneAccountHandle, Loading @@ -920,6 +961,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testSelfManagedIncoming() throws Exception { PhoneAccountHandle phoneAccountHandle = mPhoneAccountSelfManaged.getAccountHandle(); IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", phoneAccountHandle, Loading @@ -935,6 +977,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testIsOutgoingCallPermitted() throws Exception { assertTrue(mTelecomSystem.getTelecomServiceImpl().getBinder() .isOutgoingCallPermitted(mPhoneAccountSelfManaged.getAccountHandle())); Loading @@ -946,6 +989,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testIsOutgoingCallPermittedOngoing() throws Exception { // Start a regular call; the self-managed CS can't make a call now. IdPair ids = startAndMakeActiveIncomingCall("650-555-1212", Loading @@ -962,6 +1006,7 @@ public class BasicCallTests extends TelecomSystemTest { * @throws Exception */ @LargeTest @Test public void testDisconnectSelfManaged() throws Exception { // Add a self-managed call. PhoneAccountHandle phoneAccountHandle = mPhoneAccountSelfManaged.getAccountHandle(); Loading