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

Commit 821f58a3 authored by Daniel Bright's avatar Daniel Bright
Browse files

Test that on urls changed callback called on add

Added a test that that onSubscriberAssociatedUriChanged on IImsRegistrationCallback
when the callback is first added to ImsRegistrationImplBase

Bug: 159301697
Test: Made phone call
Test: Added test case
Change-Id: I5e58730a7e404e5b71c6064ee90493bd4633f281
Merged-In: I5e58730a7e404e5b71c6064ee90493bd4633f281
parent 1cb6a4f3
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.AdditionalMatchers;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;

@@ -229,4 +230,35 @@ public class ImsRegistrationTests {
        // with onUnregistered.
        verify(mCallback2, never()).onDeregistered(any(ImsReasonInfo.class));
    }

    @SmallTest
    @Test
    public void testRegistrationCallbackCalledOnAdd() throws RemoteException {
        mRegistration.onSubscriberAssociatedUriChanged(new Uri[] { null, null });

        mRegBinder.addRegistrationCallback(mCallback2);

        verify(mCallback2).onSubscriberAssociatedUriChanged(
                AdditionalMatchers.aryEq(new Uri[] { null, null }));
    }

    @SmallTest
    @Test
    public void testRegistrationCallbackNotCalledOnAddAfterDeregistered() throws RemoteException {
        ImsReasonInfo info = new ImsReasonInfo(ImsReasonInfo.CODE_LOCAL_NETWORK_NO_LTE_COVERAGE, 0);
        mRegistration.onSubscriberAssociatedUriChanged(new Uri[] { null, null });

        mRegistration.onDeregistered(info);
        mRegBinder.addRegistrationCallback(mCallback2);

        verify(mCallback2, never()).onSubscriberAssociatedUriChanged(any());
    }

    @SmallTest
    @Test
    public void testRegistrationCallbackNotCalledOnAddAndNoSubscriberChanged()
            throws RemoteException {
        mRegBinder.addRegistrationCallback(mCallback2);
        verify(mCallback2, never()).onSubscriberAssociatedUriChanged(any());
    }
}