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

Commit 71f9964b authored by Andrew Cheng's avatar Andrew Cheng Committed by Automerger Merge Worker
Browse files

Merge "MapClientStateMachineTest: use FlagsParameterization and @EnableFlags"...

Merge "MapClientStateMachineTest: use FlagsParameterization and @EnableFlags" into main am: 925a1076

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/3165298



Change-Id: I7d421ccd6d90795bbd1e8c3260c1232b1d26f33b
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f60087d1 925a1076
Loading
Loading
Loading
Loading
+19 −8
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.flag.junit.FlagsParameterization;
import android.platform.test.flag.junit.SetFlagsRule;
import android.provider.Telephony.Sms;
import android.telephony.SmsManager;
@@ -51,7 +53,6 @@ import android.util.Log;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.MediumTest;
import androidx.test.rule.ServiceTestRule;
import androidx.test.runner.AndroidJUnit4;

import com.android.bluetooth.TestUtils;
import com.android.bluetooth.btservice.AdapterService;
@@ -76,6 +77,9 @@ import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;

import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
import platform.test.runner.parameterized.Parameters;

import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
@@ -85,12 +89,12 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

@MediumTest
@RunWith(AndroidJUnit4.class)
@RunWith(ParameterizedAndroidJunit4.class)
public class MapClientStateMachineTest {

    private static final String TAG = "MapStateMachineTest";

    @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
    @Rule public final SetFlagsRule mSetFlagsRule;

    private static final int ASYNC_CALL_TIMEOUT_MILLIS = 100;
    private static final int DISCONNECT_TIMEOUT = 3000;
@@ -186,6 +190,16 @@ public class MapClientStateMachineTest {
        }
    }

    @Parameters(name = "{0}")
    public static List<FlagsParameterization> getParams() {
        return FlagsParameterization.progressionOf(
                Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS);
    }

    public MapClientStateMachineTest(FlagsParameterization flags) {
        mSetFlagsRule = new SetFlagsRule(flags);
    }

    @Before
    public void setUp() throws Exception {
        mTargetContext = InstrumentationRegistry.getTargetContext();
@@ -1060,7 +1074,6 @@ public class MapClientStateMachineTest {
     */
    @Test
    public void testSendMapMessageSentPendingIntent_notifyStatusSuccess() {
        mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS);
        testSendMapMessagePendingIntents_base(
                ACTION_MESSAGE_SENT, EventReport.Type.SENDING_SUCCESS);

@@ -1078,7 +1091,6 @@ public class MapClientStateMachineTest {
     */
    @Test
    public void testSendMapMessageDeliveryPendingIntent_notifyStatusSuccess() {
        mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS);
        testSendMapMessagePendingIntents_base(
                ACTION_MESSAGE_DELIVERED, EventReport.Type.DELIVERY_SUCCESS);

@@ -1097,7 +1109,6 @@ public class MapClientStateMachineTest {
     */
    @Test
    public void testSendMapMessageNullPendingIntent_noNotifyStatus() {
        mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS);
        testSendMapMessagePendingIntents_base(null, EventReport.Type.SENDING_SUCCESS);

        assertThat(mSentDeliveryReceiver.isActionReceived(PENDING_INTENT_TIMEOUT_MS)).isFalse();
@@ -1112,8 +1123,8 @@ public class MapClientStateMachineTest {
     * <p>Outcome: - SENT_STATUS Intent was broadcast with 'Failure' result code.
     */
    @Test
    @EnableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS)
    public void testSendMapMessageSentPendingIntent_notifyStatusFailure() {
        mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS);
        testSendMapMessagePendingIntents_base(
                ACTION_MESSAGE_SENT, EventReport.Type.SENDING_FAILURE);

@@ -1131,8 +1142,8 @@ public class MapClientStateMachineTest {
     * <p>Outcome: - DELIVERY_STATUS Intent was broadcast with 'Failure' result code.
     */
    @Test
    @EnableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS)
    public void testSendMapMessageDeliveryPendingIntent_notifyStatusFailure() {
        mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS);
        testSendMapMessagePendingIntents_base(
                ACTION_MESSAGE_DELIVERED, EventReport.Type.DELIVERY_FAILURE);