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

Commit 369fd788 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Fix Telecom unit tests.

Cherry-pick from internal master.
This was originally caused by a change in b/37106957.

Bug: 37106957
Merged-In: Ia60d85410ec9824cb45c3678977499dcb8962ea0
Change-Id: Ia60d85410ec9824cb45c3678977499dcb8962ea0
(cherry picked from commit ff5fb18a)
parent 3048c360
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;
@@ -322,6 +323,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;