Loading android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientStateMachineTest.java +19 −8 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,8 @@ import android.net.Uri; import android.os.Handler; import android.os.Handler; import android.os.Looper; import android.os.Looper; import android.os.Message; 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.platform.test.flag.junit.SetFlagsRule; import android.provider.Telephony.Sms; import android.provider.Telephony.Sms; import android.telephony.SmsManager; import android.telephony.SmsManager; Loading @@ -51,7 +53,6 @@ import android.util.Log; import androidx.test.InstrumentationRegistry; import androidx.test.InstrumentationRegistry; import androidx.test.filters.MediumTest; import androidx.test.filters.MediumTest; import androidx.test.rule.ServiceTestRule; import androidx.test.rule.ServiceTestRule; import androidx.test.runner.AndroidJUnit4; import com.android.bluetooth.TestUtils; import com.android.bluetooth.TestUtils; import com.android.bluetooth.btservice.AdapterService; import com.android.bluetooth.btservice.AdapterService; Loading @@ -76,6 +77,9 @@ import org.mockito.Mockito; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; import org.mockito.junit.MockitoRule; import platform.test.runner.parameterized.ParameterizedAndroidJunit4; import platform.test.runner.parameterized.Parameters; import java.time.Instant; import java.time.Instant; import java.util.ArrayList; import java.util.ArrayList; import java.util.HashMap; import java.util.HashMap; Loading @@ -85,12 +89,12 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit; @MediumTest @MediumTest @RunWith(AndroidJUnit4.class) @RunWith(ParameterizedAndroidJunit4.class) public class MapClientStateMachineTest { public class MapClientStateMachineTest { private static final String TAG = "MapStateMachineTest"; 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 ASYNC_CALL_TIMEOUT_MILLIS = 100; private static final int DISCONNECT_TIMEOUT = 3000; private static final int DISCONNECT_TIMEOUT = 3000; Loading Loading @@ -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 @Before public void setUp() throws Exception { public void setUp() throws Exception { mTargetContext = InstrumentationRegistry.getTargetContext(); mTargetContext = InstrumentationRegistry.getTargetContext(); Loading Loading @@ -1060,7 +1074,6 @@ public class MapClientStateMachineTest { */ */ @Test @Test public void testSendMapMessageSentPendingIntent_notifyStatusSuccess() { public void testSendMapMessageSentPendingIntent_notifyStatusSuccess() { mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS); testSendMapMessagePendingIntents_base( testSendMapMessagePendingIntents_base( ACTION_MESSAGE_SENT, EventReport.Type.SENDING_SUCCESS); ACTION_MESSAGE_SENT, EventReport.Type.SENDING_SUCCESS); Loading @@ -1078,7 +1091,6 @@ public class MapClientStateMachineTest { */ */ @Test @Test public void testSendMapMessageDeliveryPendingIntent_notifyStatusSuccess() { public void testSendMapMessageDeliveryPendingIntent_notifyStatusSuccess() { mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS); testSendMapMessagePendingIntents_base( testSendMapMessagePendingIntents_base( ACTION_MESSAGE_DELIVERED, EventReport.Type.DELIVERY_SUCCESS); ACTION_MESSAGE_DELIVERED, EventReport.Type.DELIVERY_SUCCESS); Loading @@ -1097,7 +1109,6 @@ public class MapClientStateMachineTest { */ */ @Test @Test public void testSendMapMessageNullPendingIntent_noNotifyStatus() { public void testSendMapMessageNullPendingIntent_noNotifyStatus() { mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS); testSendMapMessagePendingIntents_base(null, EventReport.Type.SENDING_SUCCESS); testSendMapMessagePendingIntents_base(null, EventReport.Type.SENDING_SUCCESS); assertThat(mSentDeliveryReceiver.isActionReceived(PENDING_INTENT_TIMEOUT_MS)).isFalse(); assertThat(mSentDeliveryReceiver.isActionReceived(PENDING_INTENT_TIMEOUT_MS)).isFalse(); Loading @@ -1112,8 +1123,8 @@ public class MapClientStateMachineTest { * <p>Outcome: - SENT_STATUS Intent was broadcast with 'Failure' result code. * <p>Outcome: - SENT_STATUS Intent was broadcast with 'Failure' result code. */ */ @Test @Test @EnableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS) public void testSendMapMessageSentPendingIntent_notifyStatusFailure() { public void testSendMapMessageSentPendingIntent_notifyStatusFailure() { mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS); testSendMapMessagePendingIntents_base( testSendMapMessagePendingIntents_base( ACTION_MESSAGE_SENT, EventReport.Type.SENDING_FAILURE); ACTION_MESSAGE_SENT, EventReport.Type.SENDING_FAILURE); Loading @@ -1131,8 +1142,8 @@ public class MapClientStateMachineTest { * <p>Outcome: - DELIVERY_STATUS Intent was broadcast with 'Failure' result code. * <p>Outcome: - DELIVERY_STATUS Intent was broadcast with 'Failure' result code. */ */ @Test @Test @EnableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS) public void testSendMapMessageDeliveryPendingIntent_notifyStatusFailure() { public void testSendMapMessageDeliveryPendingIntent_notifyStatusFailure() { mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS); testSendMapMessagePendingIntents_base( testSendMapMessagePendingIntents_base( ACTION_MESSAGE_DELIVERED, EventReport.Type.DELIVERY_FAILURE); ACTION_MESSAGE_DELIVERED, EventReport.Type.DELIVERY_FAILURE); Loading Loading
android/app/tests/unit/src/com/android/bluetooth/mapclient/MapClientStateMachineTest.java +19 −8 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,8 @@ import android.net.Uri; import android.os.Handler; import android.os.Handler; import android.os.Looper; import android.os.Looper; import android.os.Message; 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.platform.test.flag.junit.SetFlagsRule; import android.provider.Telephony.Sms; import android.provider.Telephony.Sms; import android.telephony.SmsManager; import android.telephony.SmsManager; Loading @@ -51,7 +53,6 @@ import android.util.Log; import androidx.test.InstrumentationRegistry; import androidx.test.InstrumentationRegistry; import androidx.test.filters.MediumTest; import androidx.test.filters.MediumTest; import androidx.test.rule.ServiceTestRule; import androidx.test.rule.ServiceTestRule; import androidx.test.runner.AndroidJUnit4; import com.android.bluetooth.TestUtils; import com.android.bluetooth.TestUtils; import com.android.bluetooth.btservice.AdapterService; import com.android.bluetooth.btservice.AdapterService; Loading @@ -76,6 +77,9 @@ import org.mockito.Mockito; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; import org.mockito.junit.MockitoRule; import platform.test.runner.parameterized.ParameterizedAndroidJunit4; import platform.test.runner.parameterized.Parameters; import java.time.Instant; import java.time.Instant; import java.util.ArrayList; import java.util.ArrayList; import java.util.HashMap; import java.util.HashMap; Loading @@ -85,12 +89,12 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit; @MediumTest @MediumTest @RunWith(AndroidJUnit4.class) @RunWith(ParameterizedAndroidJunit4.class) public class MapClientStateMachineTest { public class MapClientStateMachineTest { private static final String TAG = "MapStateMachineTest"; 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 ASYNC_CALL_TIMEOUT_MILLIS = 100; private static final int DISCONNECT_TIMEOUT = 3000; private static final int DISCONNECT_TIMEOUT = 3000; Loading Loading @@ -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 @Before public void setUp() throws Exception { public void setUp() throws Exception { mTargetContext = InstrumentationRegistry.getTargetContext(); mTargetContext = InstrumentationRegistry.getTargetContext(); Loading Loading @@ -1060,7 +1074,6 @@ public class MapClientStateMachineTest { */ */ @Test @Test public void testSendMapMessageSentPendingIntent_notifyStatusSuccess() { public void testSendMapMessageSentPendingIntent_notifyStatusSuccess() { mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS); testSendMapMessagePendingIntents_base( testSendMapMessagePendingIntents_base( ACTION_MESSAGE_SENT, EventReport.Type.SENDING_SUCCESS); ACTION_MESSAGE_SENT, EventReport.Type.SENDING_SUCCESS); Loading @@ -1078,7 +1091,6 @@ public class MapClientStateMachineTest { */ */ @Test @Test public void testSendMapMessageDeliveryPendingIntent_notifyStatusSuccess() { public void testSendMapMessageDeliveryPendingIntent_notifyStatusSuccess() { mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS); testSendMapMessagePendingIntents_base( testSendMapMessagePendingIntents_base( ACTION_MESSAGE_DELIVERED, EventReport.Type.DELIVERY_SUCCESS); ACTION_MESSAGE_DELIVERED, EventReport.Type.DELIVERY_SUCCESS); Loading @@ -1097,7 +1109,6 @@ public class MapClientStateMachineTest { */ */ @Test @Test public void testSendMapMessageNullPendingIntent_noNotifyStatus() { public void testSendMapMessageNullPendingIntent_noNotifyStatus() { mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS); testSendMapMessagePendingIntents_base(null, EventReport.Type.SENDING_SUCCESS); testSendMapMessagePendingIntents_base(null, EventReport.Type.SENDING_SUCCESS); assertThat(mSentDeliveryReceiver.isActionReceived(PENDING_INTENT_TIMEOUT_MS)).isFalse(); assertThat(mSentDeliveryReceiver.isActionReceived(PENDING_INTENT_TIMEOUT_MS)).isFalse(); Loading @@ -1112,8 +1123,8 @@ public class MapClientStateMachineTest { * <p>Outcome: - SENT_STATUS Intent was broadcast with 'Failure' result code. * <p>Outcome: - SENT_STATUS Intent was broadcast with 'Failure' result code. */ */ @Test @Test @EnableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS) public void testSendMapMessageSentPendingIntent_notifyStatusFailure() { public void testSendMapMessageSentPendingIntent_notifyStatusFailure() { mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS); testSendMapMessagePendingIntents_base( testSendMapMessagePendingIntents_base( ACTION_MESSAGE_SENT, EventReport.Type.SENDING_FAILURE); ACTION_MESSAGE_SENT, EventReport.Type.SENDING_FAILURE); Loading @@ -1131,8 +1142,8 @@ public class MapClientStateMachineTest { * <p>Outcome: - DELIVERY_STATUS Intent was broadcast with 'Failure' result code. * <p>Outcome: - DELIVERY_STATUS Intent was broadcast with 'Failure' result code. */ */ @Test @Test @EnableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS) public void testSendMapMessageDeliveryPendingIntent_notifyStatusFailure() { public void testSendMapMessageDeliveryPendingIntent_notifyStatusFailure() { mSetFlagsRule.enableFlags(Flags.FLAG_HANDLE_DELIVERY_SENDING_FAILURE_EVENTS); testSendMapMessagePendingIntents_base( testSendMapMessagePendingIntents_base( ACTION_MESSAGE_DELIVERED, EventReport.Type.DELIVERY_FAILURE); ACTION_MESSAGE_DELIVERED, EventReport.Type.DELIVERY_FAILURE); Loading