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

Commit 3dac311b authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Fix potential test issue related to metrics in ImsPhoneConnection.

Allow for mocking of the TelephonyMetrics instance used in the test.
This is not related to what this particular test is testing.  Although
it runs fine locally it seems in cloud testing there are some dependencies
not being met.

Fixes: 186693611
Test: Modify unit test
Change-Id: Ie75419397c01cc0329201a55969432e56c048c8f
parent 61674182
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import android.text.TextUtils;
import com.android.ims.ImsCall;
import com.android.ims.ImsException;
import com.android.ims.internal.ImsVideoCallProviderWrapper;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.Connection;
import com.android.internal.telephony.Phone;
@@ -311,6 +312,10 @@ public class ImsPhoneConnection extends Connection implements
        }
    }

    @VisibleForTesting
    public void setTelephonyMetrics(TelephonyMetrics tm) {
        mMetrics = tm;
    }

    public void dispose() {
    }
+2 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ import com.android.internal.telephony.Connection;
import com.android.internal.telephony.GsmCdmaCall;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyTest;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.metrics.VoiceCallSessionStats;

import org.junit.After;
@@ -459,6 +460,7 @@ public class ImsPhoneConnectionTest extends TelephonyTest {
        when(mImsPhone.getVoiceCallSessionStats()).thenReturn(stats);

        mConnectionUT = new ImsPhoneConnection(mImsPhone, imsCall, mImsCT, mForeGroundCall, false);
        mConnectionUT.setTelephonyMetrics(mock(TelephonyMetrics.class));
        CountDownLatch latch = new CountDownLatch(1);
        boolean[] receivedCountCallback = new boolean[1];
        mConnectionUT.addListener(new Connection.ListenerBase() {