Merge "Add test annotations for APCT" into nyc-dev
diff --git a/tests/src/com/android/server/telecom/tests/CallLogManagerTest.java b/tests/src/com/android/server/telecom/tests/CallLogManagerTest.java
index e9cf022..7f5297a 100644
--- a/tests/src/com/android/server/telecom/tests/CallLogManagerTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallLogManagerTest.java
@@ -32,6 +32,7 @@
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.VideoProfile;
+import android.test.suitebuilder.annotation.MediumTest;
import com.android.server.telecom.Call;
import com.android.server.telecom.CallLogManager;
@@ -131,6 +132,7 @@
when(userManager.getUserInfo(eq(MANAGED_USER_ID))).thenReturn(managedProfileUserInfo);
}
+ @MediumTest
public void testDontLogCancelledCall() {
Call fakeCall = makeFakeCall(
DisconnectCause.CANCELED,
@@ -150,6 +152,7 @@
verifyNoInsertion();
}
+ @MediumTest
public void testDontLogChoosingAccountCall() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mDefaultAccountHandle, CURRENT_USER_ID));
@@ -170,6 +173,7 @@
verifyNoInsertion();
}
+ @MediumTest
public void testDontLogCallsFromEmergencyAccount() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(EMERGENCY_ACCT_HANDLE, 0));
@@ -191,6 +195,7 @@
verifyNoInsertion();
}
+ @MediumTest
public void testLogCallDirectionOutgoing() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mDefaultAccountHandle, CURRENT_USER_ID));
@@ -213,6 +218,7 @@
Integer.valueOf(CallLog.Calls.OUTGOING_TYPE));
}
+ @MediumTest
public void testLogCallDirectionIncoming() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mDefaultAccountHandle, CURRENT_USER_ID));
@@ -235,6 +241,7 @@
Integer.valueOf(CallLog.Calls.INCOMING_TYPE));
}
+ @MediumTest
public void testLogCallDirectionMissed() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mDefaultAccountHandle, CURRENT_USER_ID));
@@ -258,6 +265,7 @@
Integer.valueOf(CallLog.Calls.MISSED_TYPE));
}
+ @MediumTest
public void testCreationTimeAndAge() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mDefaultAccountHandle, CURRENT_USER_ID));
@@ -283,6 +291,7 @@
Long.valueOf(duration / 1000));
}
+ @MediumTest
public void testLogPhoneAccountId() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mDefaultAccountHandle, CURRENT_USER_ID));
@@ -304,6 +313,7 @@
TEST_PHONE_ACCOUNT_ID);
}
+ @MediumTest
public void testLogCorrectPhoneNumber() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mDefaultAccountHandle, CURRENT_USER_ID));
@@ -326,6 +336,7 @@
assertEquals(insertedValues.getAsString(CallLog.Calls.POST_DIAL_DIGITS), POST_DIAL_STRING);
}
+ @MediumTest
public void testLogCallVideoFeatures() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mDefaultAccountHandle, CURRENT_USER_ID));
@@ -347,6 +358,7 @@
& CallLog.Calls.FEATURES_VIDEO) == CallLog.Calls.FEATURES_VIDEO);
}
+ @MediumTest
public void testLogCallDirectionOutgoingWithMultiUserCapability() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mOtherUserAccountHandle,
@@ -377,6 +389,7 @@
verifyNoInsertionInUser(MANAGED_USER_ID);
}
+ @MediumTest
public void testLogCallDirectionIncomingWithMultiUserCapability() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mOtherUserAccountHandle,
@@ -407,7 +420,7 @@
verifyNoInsertionInUser(MANAGED_USER_ID);
}
-
+ @MediumTest
public void testLogCallDirectionOutgoingWithMultiUserCapabilityFromManagedProfile() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mManagedProfileAccountHandle,
@@ -435,6 +448,7 @@
Integer.valueOf(CallLog.Calls.OUTGOING_TYPE));
}
+ @MediumTest
public void testLogCallDirectionOutgoingFromManagedProfile() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mManagedProfileAccountHandle, 0));
@@ -462,6 +476,7 @@
Integer.valueOf(CallLog.Calls.OUTGOING_TYPE));
}
+ @MediumTest
public void testLogCallDirectionIngoingFromManagedProfile() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mManagedProfileAccountHandle, 0));
@@ -492,6 +507,7 @@
/**
* Ensure call data usage is persisted to the call log when present in the call.
*/
+ @MediumTest
public void testLogCallDataUsageSet() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mDefaultAccountHandle, CURRENT_USER_ID));
@@ -516,6 +532,7 @@
/**
* Ensures call data usage is null in the call log when not set on the call.
*/
+ @MediumTest
public void testLogCallDataUsageNotSet() {
when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
.thenReturn(makeFakePhoneAccount(mDefaultAccountHandle, CURRENT_USER_ID));
diff --git a/tests/src/com/android/server/telecom/tests/ContactsAsyncHelperTest.java b/tests/src/com/android/server/telecom/tests/ContactsAsyncHelperTest.java
index 07ae122..363d613 100644
--- a/tests/src/com/android/server/telecom/tests/ContactsAsyncHelperTest.java
+++ b/tests/src/com/android/server/telecom/tests/ContactsAsyncHelperTest.java
@@ -21,6 +21,7 @@
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
+import android.test.suitebuilder.annotation.SmallTest;
import com.android.server.telecom.ContactsAsyncHelper;
@@ -85,6 +86,7 @@
super.setUp();
}
+ @SmallTest
public void testEmptyUri() {
ContactsAsyncHelper cah = new ContactsAsyncHelper(mNullContentResolverAdapter);
try {
@@ -96,6 +98,7 @@
any(Drawable.class), any(Bitmap.class), anyObject());
}
+ @SmallTest
public void testNullReturnFromOpenInputStream() {
ContactsAsyncHelper cah = new ContactsAsyncHelper(mNullContentResolverAdapter);
cah.startObtainPhotoAsync(TOKEN, mContext, SAMPLE_CONTACT_PHOTO_URI, mListener, COOKIE);
@@ -104,6 +107,7 @@
isNull(Drawable.class), isNull(Bitmap.class), eq(COOKIE));
}
+ @SmallTest
public void testImageScaling() {
ContactsAsyncHelper cah = new ContactsAsyncHelper(mWorkingContentResolverAdapter);
cah.startObtainPhotoAsync(TOKEN, mContext, SAMPLE_CONTACT_PHOTO_URI, mListener, COOKIE);
@@ -122,6 +126,7 @@
assertTrue(iconSize >= iconCaptor.getValue().getWidth());
}
+ @SmallTest
public void testNoScaling() {
ContactsAsyncHelper cah = new ContactsAsyncHelper(mWorkingContentResolverAdapter);
cah.startObtainPhotoAsync(TOKEN, mContext, SAMPLE_CONTACT_PHOTO_URI_SMALL,
diff --git a/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java b/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java
index 462593b..17ca5b9 100644
--- a/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java
+++ b/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java
@@ -31,6 +31,7 @@
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
import android.telephony.DisconnectCause;
+import android.test.suitebuilder.annotation.SmallTest;
import com.android.server.telecom.Call;
import com.android.server.telecom.CallsManager;
@@ -76,6 +77,7 @@
mPhoneNumberUtilsAdapterSpy = spy(new PhoneNumberUtilsAdapterImpl());
}
+ @SmallTest
public void testNullHandle() {
Intent intent = new Intent(Intent.ACTION_CALL, null);
int result = processIntent(intent, true);
@@ -84,6 +86,7 @@
verifyNoCallPlaced();
}
+ @SmallTest
public void testVoicemailCall() {
String voicemailNumber = "voicemail:18005551234";
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(voicemailNumber));
@@ -96,14 +99,17 @@
any(GatewayInfo.class), eq(true), eq(VideoProfile.STATE_AUDIO_ONLY));
}
+ @SmallTest
public void testVoicemailCallWithBadAction() {
badCallActionHelper(Uri.parse("voicemail:18005551234"), DisconnectCause.OUTGOING_CANCELED);
}
+ @SmallTest
public void testTelCallWithBadCallAction() {
badCallActionHelper(Uri.parse("tel:6505551234"), DisconnectCause.INVALID_NUMBER);
}
+ @SmallTest
public void testSipCallWithBadCallAction() {
badCallActionHelper(Uri.parse("sip:testuser@testsite.com"), DisconnectCause.INVALID_NUMBER);
}
@@ -118,6 +124,7 @@
verifyNoCallPlaced();
}
+ @SmallTest
public void testNoNumberSupplied() {
Uri handle = Uri.parse("tel:");
Intent intent = new Intent(Intent.ACTION_CALL, handle);
@@ -129,7 +136,7 @@
verifyNoCallPlaced();
}
-
+ @SmallTest
public void testEmergencyCallWithNonDefaultDialer() {
Uri handle = Uri.parse("tel:6505551911");
doReturn(true).when(mPhoneNumberUtilsAdapterSpy).isPotentialLocalEmergencyNumber(
@@ -158,24 +165,28 @@
assertEquals(Intent.FLAG_ACTIVITY_NEW_TASK, dialerIntent.getFlags());
}
+ @SmallTest
public void testActionCallEmergencyCall() {
Uri handle = Uri.parse("tel:6505551911");
Intent intent = buildIntent(handle, Intent.ACTION_CALL, null);
emergencyCallTestHelper(intent, null);
}
+ @SmallTest
public void testActionEmergencyWithEmergencyNumber() {
Uri handle = Uri.parse("tel:6505551911");
Intent intent = buildIntent(handle, Intent.ACTION_CALL_EMERGENCY, null);
emergencyCallTestHelper(intent, null);
}
+ @SmallTest
public void testActionPrivCallWithEmergencyNumber() {
Uri handle = Uri.parse("tel:6505551911");
Intent intent = buildIntent(handle, Intent.ACTION_CALL_PRIVILEGED, null);
emergencyCallTestHelper(intent, null);
}
+ @SmallTest
public void testEmergencyCallWithGatewayExtras() {
Uri handle = Uri.parse("tel:6505551911");
Bundle gatewayExtras = new Bundle();
@@ -187,6 +198,7 @@
emergencyCallTestHelper(intent, gatewayExtras);
}
+ @SmallTest
public void testActionEmergencyWithNonEmergencyNumber() {
Uri handle = Uri.parse("tel:6505551911");
doReturn(false).when(mPhoneNumberUtilsAdapterSpy).isPotentialLocalEmergencyNumber(
@@ -222,6 +234,7 @@
assertNull(receiver);
}
+ @SmallTest
public void testUnmodifiedRegularCall() {
Uri handle = Uri.parse("tel:6505551234");
Intent callIntent = buildIntent(handle, Intent.ACTION_CALL, null);
@@ -236,6 +249,7 @@
eq(true), eq(VideoProfile.STATE_BIDIRECTIONAL));
}
+ @SmallTest
public void testUnmodifiedSipCall() {
Uri handle = Uri.parse("sip:test@test.com");
Intent callIntent = buildIntent(handle, Intent.ACTION_CALL, null);
@@ -252,6 +266,7 @@
eq(true), eq(VideoProfile.STATE_BIDIRECTIONAL));
}
+ @SmallTest
public void testCallWithGatewayInfo() {
Uri handle = Uri.parse("tel:6505551234");
Intent callIntent = buildIntent(handle, Intent.ACTION_CALL, null);
@@ -270,6 +285,7 @@
isNotNull(GatewayInfo.class), eq(true), eq(VideoProfile.STATE_BIDIRECTIONAL));
}
+ @SmallTest
public void testCallNumberModifiedToNull() {
Uri handle = Uri.parse("tel:6505551234");
Intent callIntent = buildIntent(handle, Intent.ACTION_CALL, null);
@@ -282,6 +298,7 @@
verify(mCall).disconnect(true);
}
+ @SmallTest
public void testCallModifiedToEmergency() {
Uri handle = Uri.parse("tel:6505551234");
Intent callIntent = buildIntent(handle, Intent.ACTION_CALL, null);
diff --git a/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java b/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java
index e49e986..d0b723a 100644
--- a/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java
+++ b/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java
@@ -38,6 +38,7 @@
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
import android.telephony.TelephonyManager;
+import android.test.suitebuilder.annotation.SmallTest;
import com.android.internal.telecom.ITelecomService;
import com.android.server.telecom.Call;
@@ -203,6 +204,7 @@
.isDefaultOrSystemDialer(any(Context.class), eq(DEFAULT_DIALER_PACKAGE));
}
+ @SmallTest
public void testGetDefaultOutgoingPhoneAccount() throws RemoteException {
when(mFakePhoneAccountRegistrar
.getOutgoingPhoneAccountForScheme(eq("tel"), any(UserHandle.class)))
@@ -221,6 +223,7 @@
assertEquals(SIP_PA_HANDLE_17, returnedHandleSip);
}
+ @SmallTest
public void testGetDefaultOutgoingPhoneAccountFailure() throws RemoteException {
// make sure that the list of user profiles doesn't include anything the PhoneAccountHandles
// are associated with
@@ -240,6 +243,7 @@
assertNull(returnedHandleTel);
}
+ @SmallTest
public void testGetUserSelectedOutgoingPhoneAccount() throws RemoteException {
when(mFakePhoneAccountRegistrar.getUserSelectedOutgoingPhoneAccount(any(UserHandle.class)))
.thenReturn(TEL_PA_HANDLE_16);
@@ -251,12 +255,14 @@
assertEquals(TEL_PA_HANDLE_16, returnedHandle);
}
+ @SmallTest
public void testSetUserSelectedOutgoingPhoneAccount() throws RemoteException {
mTSIBinder.setUserSelectedOutgoingPhoneAccount(TEL_PA_HANDLE_16);
verify(mFakePhoneAccountRegistrar)
.setUserSelectedOutgoingPhoneAccount(eq(TEL_PA_HANDLE_16), any(UserHandle.class));
}
+ @SmallTest
public void testSetUserSelectedOutgoingPhoneAccountFailure() throws RemoteException {
doThrow(new SecurityException()).when(mContext).enforceCallingOrSelfPermission(
anyString(), anyString());
@@ -270,6 +276,7 @@
any(PhoneAccountHandle.class), any(UserHandle.class));
}
+ @SmallTest
public void testGetCallCapablePhoneAccounts() throws RemoteException {
List<PhoneAccountHandle> fullPHList = new ArrayList<PhoneAccountHandle>() {{
add(TEL_PA_HANDLE_16);
@@ -295,6 +302,7 @@
mTSIBinder.getCallCapablePhoneAccounts(false, DEFAULT_DIALER_PACKAGE));
}
+ @SmallTest
public void testGetCallCapablePhoneAccountsFailure() throws RemoteException {
List<String> enforcedPermissions = new ArrayList<String>() {{
add(READ_PHONE_STATE);
@@ -314,6 +322,7 @@
.getCallCapablePhoneAccounts(anyString(), anyBoolean(), any(UserHandle.class));
}
+ @SmallTest
public void testGetPhoneAccountsSupportingScheme() throws RemoteException {
List<PhoneAccountHandle> sipPHList = new ArrayList<PhoneAccountHandle>() {{
add(SIP_PA_HANDLE_17);
@@ -336,6 +345,7 @@
mTSIBinder.getPhoneAccountsSupportingScheme("sip", DEFAULT_DIALER_PACKAGE));
}
+ @SmallTest
public void testGetPhoneAccountsForPackage() throws RemoteException {
List<PhoneAccountHandle> phoneAccountHandleList = new ArrayList<PhoneAccountHandle>() {{
add(TEL_PA_HANDLE_16);
@@ -350,6 +360,7 @@
TEL_PA_HANDLE_16.getComponentName().getPackageName()));
}
+ @SmallTest
public void testGetPhoneAccount() throws RemoteException {
makeAccountsVisibleToAllUsers(TEL_PA_HANDLE_16, SIP_PA_HANDLE_17);
assertEquals(TEL_PA_HANDLE_16, mTSIBinder.getPhoneAccount(TEL_PA_HANDLE_16)
@@ -358,6 +369,7 @@
.getAccountHandle());
}
+ @SmallTest
public void testGetAllPhoneAccounts() throws RemoteException {
List<PhoneAccount> phoneAccountList = new ArrayList<PhoneAccount>() {{
add(makePhoneAccount(TEL_PA_HANDLE_16).build());
@@ -369,6 +381,7 @@
assertEquals(2, mTSIBinder.getAllPhoneAccounts().size());
}
+ @SmallTest
public void testRegisterPhoneAccount() throws RemoteException {
String packageNameToUse = "com.android.officialpackage";
PhoneAccountHandle phHandle = new PhoneAccountHandle(new ComponentName(
@@ -380,6 +393,7 @@
registerPhoneAccountTestHelper(phoneAccount, true);
}
+ @SmallTest
public void testRegisterPhoneAccountWithoutModifyPermission() throws RemoteException {
// tests the case where the package does not have MODIFY_PHONE_STATE but is
// registering its own phone account as a third-party connection service
@@ -396,6 +410,7 @@
registerPhoneAccountTestHelper(phoneAccount, true);
}
+ @SmallTest
public void testRegisterPhoneAccountWithoutModifyPermissionFailure() throws RemoteException {
// tests the case where the third party package should not be allowed to register a phone
// account due to the lack of modify permission.
@@ -412,6 +427,7 @@
registerPhoneAccountTestHelper(phoneAccount, false);
}
+ @SmallTest
public void testRegisterPhoneAccountWithoutSimSubscriptionPermissionFailure()
throws RemoteException {
String packageNameToUse = "com.thirdparty.connectionservice";
@@ -429,6 +445,7 @@
registerPhoneAccountTestHelper(phoneAccount, false);
}
+ @SmallTest
public void testRegisterPhoneAccountWithoutMultiUserPermissionFailure()
throws Exception {
String packageNameToUse = "com.thirdparty.connectionservice";
@@ -478,6 +495,7 @@
}
}
+ @SmallTest
public void testUnregisterPhoneAccount() throws RemoteException {
String packageNameToUse = "com.android.officialpackage";
PhoneAccountHandle phHandle = new PhoneAccountHandle(new ComponentName(
@@ -499,6 +517,7 @@
assertEquals(phHandle, intentExtras.get(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE));
}
+ @SmallTest
public void testUnregisterPhoneAccountFailure() throws RemoteException {
String packageNameToUse = "com.thirdparty.connectionservice";
PhoneAccountHandle phHandle = new PhoneAccountHandle(new ComponentName(
@@ -520,6 +539,7 @@
.sendBroadcastAsUser(any(Intent.class), any(UserHandle.class), anyString());
}
+ @SmallTest
public void testAddNewIncomingCall() throws Exception {
doNothing().when(mAppOpsManager).checkPackage(anyInt(), anyString());
Bundle extras = createSampleExtras();
@@ -530,6 +550,7 @@
CallIntentProcessor.KEY_IS_INCOMING_CALL, extras, false);
}
+ @SmallTest
public void testAddNewIncomingCallFailure() throws Exception {
try {
mTSIBinder.addNewIncomingCall(TEL_PA_HANDLE_16, null);
@@ -550,6 +571,7 @@
.processIncomingCallIntent(any(CallsManager.class), any(Intent.class));
}
+ @SmallTest
public void testAddNewUnknownCall() throws Exception {
doNothing().when(mAppOpsManager).checkPackage(anyInt(), anyString());
Bundle extras = createSampleExtras();
@@ -560,6 +582,7 @@
CallIntentProcessor.KEY_IS_UNKNOWN_CALL, extras, true);
}
+ @SmallTest
public void testAddNewUnknownCallFailure() throws Exception {
try {
mTSIBinder.addNewUnknownCall(TEL_PA_HANDLE_16, null);
@@ -609,6 +632,7 @@
}
}
+ @SmallTest
public void testPlaceCallWithNonEmergencyPermission() throws Exception {
Uri handle = Uri.parse("tel:6505551234");
Bundle extras = createSampleExtras();
@@ -622,6 +646,7 @@
placeCallTestHelper(handle, extras, true);
}
+ @SmallTest
public void testPlaceCallWithAppOpsOff() throws Exception {
Uri handle = Uri.parse("tel:6505551234");
Bundle extras = createSampleExtras();
@@ -635,6 +660,7 @@
placeCallTestHelper(handle, extras, false);
}
+ @SmallTest
public void testPlaceCallWithNoCallingPermission() throws Exception {
Uri handle = Uri.parse("tel:6505551234");
Bundle extras = createSampleExtras();
@@ -659,6 +685,7 @@
assertTrue(areBundlesEqual(expectedExtras, capturedIntent.getExtras()));
}
+ @SmallTest
public void testPlaceCallFailure() throws Exception {
Uri handle = Uri.parse("tel:6505551234");
Bundle extras = createSampleExtras();
@@ -676,6 +703,7 @@
.processIntent(any(Intent.class), anyString(), anyBoolean());
}
+ @SmallTest
public void testSetDefaultDialer() throws Exception {
String packageName = "sample.package";
@@ -696,12 +724,14 @@
assertEquals(packageName, packageNameExtra);
}
+ @SmallTest
public void testSetDefaultDialerNoModifyPhoneStatePermission() throws Exception {
doThrow(new SecurityException()).when(mContext).enforceCallingOrSelfPermission(
eq(MODIFY_PHONE_STATE), anyString());
setDefaultDialerFailureTestHelper();
}
+ @SmallTest
public void testSetDefaultDialerNoWriteSecureSettingsPermission() throws Exception {
doThrow(new SecurityException()).when(mContext).enforceCallingOrSelfPermission(
eq(WRITE_SECURE_SETTINGS), anyString());
@@ -721,6 +751,7 @@
verify(mContext, never()).sendBroadcastAsUser(any(Intent.class), any(UserHandle.class));
}
+ @SmallTest
public void testIsVoicemailNumber() throws Exception {
String vmNumber = "010";
makeAccountsVisibleToAllUsers(TEL_PA_HANDLE_CURRENT);
@@ -731,6 +762,7 @@
vmNumber, DEFAULT_DIALER_PACKAGE));
}
+ @SmallTest
public void testIsVoicemailNumberAccountNotVisibleFailure() throws Exception {
String vmNumber = "010";
@@ -743,6 +775,7 @@
.isVoiceMailNumber(TEL_PA_HANDLE_CURRENT, vmNumber, DEFAULT_DIALER_PACKAGE));
}
+ @SmallTest
public void testGetVoicemailNumberWithNullAccountHandle() throws Exception {
when(mFakePhoneAccountRegistrar.getPhoneAccount(isNull(PhoneAccountHandle.class),
eq(Binder.getCallingUserHandle())))
@@ -758,6 +791,7 @@
assertEquals(vmNumber, mTSIBinder.getVoiceMailNumber(null, DEFAULT_DIALER_PACKAGE));
}
+ @SmallTest
public void testGetVoicemailNumberWithNonNullAccountHandle() throws Exception {
when(mFakePhoneAccountRegistrar.getPhoneAccount(eq(TEL_PA_HANDLE_CURRENT),
eq(Binder.getCallingUserHandle())))
@@ -775,6 +809,7 @@
mTSIBinder.getVoiceMailNumber(TEL_PA_HANDLE_CURRENT, DEFAULT_DIALER_PACKAGE));
}
+ @SmallTest
public void testGetLine1Number() throws Exception {
int subId = 58374;
String line1Number = "9482752023479";
@@ -789,6 +824,7 @@
mTSIBinder.getLine1Number(TEL_PA_HANDLE_CURRENT, DEFAULT_DIALER_PACKAGE));
}
+ @SmallTest
public void testEndCallWithRingingForegroundCall() throws Exception {
Call call = mock(Call.class);
when(call.getState()).thenReturn(CallState.RINGING);
@@ -797,6 +833,7 @@
verify(call).reject(false, null);
}
+ @SmallTest
public void testEndCallWithNonRingingForegroundCall() throws Exception {
Call call = mock(Call.class);
when(call.getState()).thenReturn(CallState.ACTIVE);
@@ -805,6 +842,7 @@
verify(call).disconnect();
}
+ @SmallTest
public void testEndCallWithNoForegroundCall() throws Exception {
Call call = mock(Call.class);
when(call.getState()).thenReturn(CallState.ACTIVE);
@@ -814,10 +852,12 @@
verify(call).disconnect();
}
+ @SmallTest
public void testEndCallWithNoCalls() throws Exception {
assertFalse(mTSIBinder.endCall());
}
+ @SmallTest
public void testAcceptRingingCall() throws Exception {
Call call = mock(Call.class);
when(mFakeCallsManager.getFirstCallWithState(any(int[].class)))
@@ -830,6 +870,7 @@
verify(call).answer(fakeVideoState);
}
+ @SmallTest
public void testAcceptRingingCallWithValidVideoState() throws Exception {
Call call = mock(Call.class);
when(mFakeCallsManager.getFirstCallWithState(any(int[].class)))