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

Commit 6cfb61b2 authored by Brad Ebinger's avatar Brad Ebinger Committed by Gerrit Code Review
Browse files

Merge "Fixes ImsService Unit Tests"

parents b40f09bc c33bd7aa
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package android.telephony.ims;


import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.RemoteException;
import android.os.RemoteException;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.runner.AndroidJUnit4;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.ImsFeature;
@@ -38,6 +39,7 @@ import org.mockito.MockitoAnnotations;


import static android.Manifest.permission.MODIFY_PHONE_STATE;
import static android.Manifest.permission.MODIFY_PHONE_STATE;
import static android.Manifest.permission.READ_PHONE_STATE;
import static android.Manifest.permission.READ_PHONE_STATE;
import static android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE;
import static com.android.internal.telephony.ims.ImsResolver.SERVICE_INTERFACE;
import static com.android.internal.telephony.ims.ImsResolver.SERVICE_INTERFACE;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNotNull;
@@ -153,6 +155,8 @@ public class ImsServiceTest {
    @Test
    @Test
    @SmallTest
    @SmallTest
    public void testMethodWithNoPermissions() throws RemoteException {
    public void testMethodWithNoPermissions() throws RemoteException {
        when(mMockContext.checkCallingOrSelfPermission(READ_PRIVILEGED_PHONE_STATE)).thenReturn(
                PackageManager.PERMISSION_DENIED);
        doThrow(new SecurityException()).when(mMockContext).enforceCallingOrSelfPermission(
        doThrow(new SecurityException()).when(mMockContext).enforceCallingOrSelfPermission(
                eq(READ_PHONE_STATE), nullable(String.class));
                eq(READ_PHONE_STATE), nullable(String.class));
        mTestImsServiceBinder.createImsFeature(TEST_SLOT_0, ImsFeature.MMTEL, mTestCallback);
        mTestImsServiceBinder.createImsFeature(TEST_SLOT_0, ImsFeature.MMTEL, mTestCallback);