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

Commit 0e0411f1 authored by Daniel Bright's avatar Daniel Bright Committed by Automerger Merge Worker
Browse files

Merge "Test that on urls changed callback called on add" am: 599e87c8

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1352668

Change-Id: Ia9a93cc40ea7213430958be661de5ce162d3160c
parents 13f4ab1a 599e87c8
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());
    }
}