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

Commit 10513cd3 authored by Willy Hu's avatar Willy Hu
Browse files

[DataStallRecoveryManagerTest] Fix the test fail

- Replace function from provessAllMessage to processAllFutureMessage

Bug: 210806613
Test: atest com.android.internal.telephony.data

Change-Id: I76f2949157517a3ec4f550a34dbac8d3378e0365
parent ee59c982
Loading
Loading
Loading
Loading
+9 −14
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import android.net.NetworkAgent;
@@ -46,7 +47,6 @@ import java.util.concurrent.Executor;
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
public class DataStallRecoveryManagerTest extends TelephonyTest {

    @Mock private DataNetworkController mDataNetworkController;
    @Mock private DataServiceManager mDataServiceManager;
    @Mock private DataStallRecoveryManagerCallback mDataStallRecoveryManagerCallback;
@@ -59,6 +59,7 @@ public class DataStallRecoveryManagerTest extends TelephonyTest {

        doReturn(mDataNetworkController).when(mPhone).getDataNetworkController();
        doReturn(mDataConfigManager).when(mDataNetworkController).getDataConfigManager();
        doReturn(mSST).when(mPhone).getServiceStateTracker();
        doAnswer(
                invocation -> {
                    ((Runnable) invocation.getArguments()[0]).run();
@@ -104,10 +105,8 @@ public class DataStallRecoveryManagerTest extends TelephonyTest {

        logd("Sending validation failed callback");
        sendValidationFailedCallback();
        processAllMessages();
        moveTimeForward(180000);
        processAllFutureMessages();

        assertThat(mDataStallRecoveryManager.getRecoveryAction()).isEqualTo(2);
        verify(mDataStallRecoveryManagerCallback).onDataStallReestablishInternet();
    }

@@ -119,10 +118,9 @@ public class DataStallRecoveryManagerTest extends TelephonyTest {

        logd("Sending validation failed callback");
        sendValidationFailedCallback();
        processAllMessages();
        moveTimeForward(180000);
        processAllFutureMessages();

        assertThat(mDataStallRecoveryManager.getRecoveryAction()).isEqualTo(3);
        verify(mSST, times(1)).powerOffRadioSafely();
    }

    @Test
@@ -134,10 +132,9 @@ public class DataStallRecoveryManagerTest extends TelephonyTest {
        logd("Sending validation failed callback");
        sendValidationFailedCallback();

        processAllMessages();
        moveTimeForward(180000);
        processAllFutureMessages();

        assertThat(mDataStallRecoveryManager.getRecoveryAction()).isEqualTo(0);
        verify(mPhone, times(1)).rebootModem(any());
    }

    @Test
@@ -150,8 +147,7 @@ public class DataStallRecoveryManagerTest extends TelephonyTest {
        logd("Sending validation failed callback");
        sendValidationFailedCallback();

        processAllMessages();
        moveTimeForward(180000);
        processAllFutureMessages();

        assertThat(mDataStallRecoveryManager.getRecoveryAction()).isEqualTo(0);
    }
@@ -166,8 +162,7 @@ public class DataStallRecoveryManagerTest extends TelephonyTest {
        logd("Sending validation failed callback");
        sendValidationFailedCallback();

        processAllMessages();
        moveTimeForward(180000);
        processAllFutureMessages();

        assertThat(mDataStallRecoveryManager.getRecoveryAction()).isEqualTo(2);
    }