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

Commit 75aa74bd authored by Daniel Bright's avatar Daniel Bright Committed by Android (Google) Code Review
Browse files

Merge "Test that on urls changed callback called on add"

parents da01fa44 a1a98bac
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());
    }
}