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

Commit 4ce2b184 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix Telecom unit tests."

parents 545b2d61 93dc55f2
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -466,22 +466,10 @@ public class TelecomServiceImplTest extends TelecomTestCase {
        if (shouldSucceed) {
            assertFalse(didExceptionOccur);
            verify(mFakePhoneAccountRegistrar).registerPhoneAccount(testPhoneAccount);
            verify(mContext).sendBroadcastAsUser(intentCaptor.capture(), eq(UserHandle.ALL),
                    anyString());

            Intent capturedIntent = intentCaptor.getValue();
            assertEquals(TelecomManager.ACTION_PHONE_ACCOUNT_REGISTERED,
                    capturedIntent.getAction());
            Bundle intentExtras = capturedIntent.getExtras();
            assertEquals(1, intentExtras.size());
            assertEquals(testPhoneAccount.getAccountHandle(),
                    intentExtras.get(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE));
        } else {
            assertTrue(didExceptionOccur);
            verify(mFakePhoneAccountRegistrar, never())
                    .registerPhoneAccount(any(PhoneAccount.class));
            verify(mContext, never())
                    .sendBroadcastAsUser(any(Intent.class), any(UserHandle.class), anyString());
        }
    }

@@ -497,14 +485,6 @@ public class TelecomServiceImplTest extends TelecomTestCase {

        mTSIBinder.unregisterPhoneAccount(phHandle);
        verify(mFakePhoneAccountRegistrar).unregisterPhoneAccount(phHandle);
        verify(mContext).sendBroadcastAsUser(intentCaptor.capture(), eq(UserHandle.ALL),
                anyString());
        Intent capturedIntent = intentCaptor.getValue();
        assertEquals(TelecomManager.ACTION_PHONE_ACCOUNT_UNREGISTERED,
                capturedIntent.getAction());
        Bundle intentExtras = capturedIntent.getExtras();
        assertEquals(1, intentExtras.size());
        assertEquals(phHandle, intentExtras.get(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE));
    }

    @SmallTest
+2 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isNull;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
@@ -311,6 +312,7 @@ public class TelecomSystemTest extends TelecomTestCase {
        super.setUp();
        mSpyContext = mComponentContextFixture.getTestDouble().getApplicationContext();
        doReturn(mSpyContext).when(mSpyContext).getApplicationContext();
        doNothing().when(mSpyContext).sendBroadcastAsUser(any(), any(), any());

        mNumOutgoingCallsMade = 0;