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

Commit 200623a0 authored by Malcolm Chen's avatar Malcolm Chen
Browse files

Fix PhoneSwitcherTest flakiness by adding a short wait.

Test: unittest
Bug: 137312631
Change-Id: Iec9fe858cfe73f667584e288aa7fd24f56a53f27
Merged-In: Iec9fe858cfe73f667584e288aa7fd24f56a53f27
parent 0e2bf01d
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ public class PhoneSwitcherTest extends TelephonyTest {
        clearInvocations(mActivePhoneSwitchHandler);

        setDefaultDataSubId(0);
        waitABit();

        verify(mActivePhoneSwitchHandler, never()).sendMessageAtTime(any(), anyLong());

@@ -507,14 +508,15 @@ public class PhoneSwitcherTest extends TelephonyTest {
        doReturn(true).when(mMockRadioConfig).isSetPreferredDataCommandSupported();
        initialize(numPhones, maxActivePhones);

        // Mark sub 2 as opportunistic.
        doReturn(true).when(mSubscriptionController).isOpportunistic(2);
        // Phone 0 has sub 1, phone 1 has sub 2.
        // Sub 1 is default data sub.
        // Both are active subscriptions are active sub, as they are in both active slots.
        setSlotIndexToSubId(0, 1);
        setSlotIndexToSubId(1, 2);
        setDefaultDataSubId(1);
        // Mark sub 2 as opportunistic.
        doReturn(true).when(mSubscriptionController).isOpportunistic(2);
        waitABit();

        // Phone 0 (sub 1) should be activated as it has default data sub.
        assertEquals(0, mPhoneSwitcher.getPreferredDataPhoneId());