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

Commit 82c72633 authored by Thomas Girardier's avatar Thomas Girardier Committed by Gerrit Code Review
Browse files

Merge "[PTS-Bot]: Added 9 MAP test cases"

parents a2a363f7 60d45321
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ class MAPProxy(ProfileProxy):
        self._android = Android(channel)

        self.connection = None
        self._init_send_sms()

    @assert_description
    def TSC_MMI_iut_connectable(self, **kwargs):
@@ -60,11 +61,16 @@ class MAPProxy(ProfileProxy):
        return "OK"

    @assert_description
    def TSC_OBEX_MMI_iut_accept_connect(self, pts_addr: bytes, **kwargs):
    def TSC_OBEX_MMI_iut_accept_connect(self, test: str, pts_addr: bytes, **kwargs):
        """
        Please accept the OBEX CONNECT REQ.
        """

        if test in {"MAP/MSE/GOEP/BC/BV-01-I", "MAP/MSE/GOEP/BC/BV-03-I", "MAP/MSE/MMN/BV-02-I"}:
            if self.connection is None:
                self._android.SetAccessPermission(address=pts_addr, access_type=AccessType.ACCESS_MESSAGE)
                self.connection = self.host.WaitConnection(address=pts_addr).connection

        return "OK"

    @assert_description
@@ -155,6 +161,9 @@ class MAPProxy(ProfileProxy):
        """
        Send Set Event Report with New GSM Message.
        """

        self._android.SendSMS()

        return "OK"

    @assert_description
@@ -171,3 +180,9 @@ class MAPProxy(ProfileProxy):
        """

        return "OK"

    def _init_send_sms(self):

        min_sms_count = 2  # Few test cases requires minimum 2 sms to pass
        for index in range(min_sms_count):
            self._android.SendSMS()
+11 −10
Original line number Diff line number Diff line
@@ -342,6 +342,8 @@
    "L2CAP/LE/CPU/BI-02-C",
    "L2CAP/LE/CPU/BV-02-C",
    "L2CAP/LE/REJ/BI-01-C",
    "MAP/MSE/GOEP/BC/BV-01-I",
    "MAP/MSE/GOEP/BC/BV-03-I",
    "MAP/MSE/GOEP/CON/BV-01-C",
    "MAP/MSE/GOEP/CON/BV-02-C",
    "MAP/MSE/GOEP/ROB/BV-01-C",
@@ -351,13 +353,20 @@
    "MAP/MSE/GOEP/SRM/BI-05-C",
    "MAP/MSE/GOEP/SRM/BV-04-C",
    "MAP/MSE/GOEP/SRM/BV-08-C",
    "MAP/MSE/GOEP/SRMP/BV-02-C",
    "MAP/MSE/MMB/BV-09-I",
    "MAP/MSE/MMB/BV-10-I",
    "MAP/MSE/MMB/BV-11-I",
    "MAP/MSE/MMB/BV-13-I",
    "MAP/MSE/MMB/BV-14-I",
    "MAP/MSE/MMB/BV-15-I",
    "MAP/MSE/MMB/BV-16-I",
    "MAP/MSE/MMB/BV-20-I",
    "MAP/MSE/MMB/BV-36-I",
    "MAP/MSE/MMD/BV-02-I",
    "MAP/MSE/MMI/BV-02-I",
    "MAP/MSE/MMN/BV-02-I",
    "MAP/MSE/MMN/BV-04-I",
    "MAP/MSE/MMN/BV-06-I",
    "MAP/MSE/MMU/BV-03-I",
    "MAP/MSE/MNR/BV-03-I",
@@ -751,16 +760,7 @@
    "L2CAP/LE/CID/BV-02-C",
    "L2CAP/LE/CPU/BV-01-C",
    "L2CAP/LE/REJ/BI-02-C",
    "MAP/MSE/GOEP/BC/BV-01-I",
    "MAP/MSE/GOEP/BC/BV-03-I",
    "MAP/MSE/GOEP/SRMP/BI-02-C",
    "MAP/MSE/GOEP/SRMP/BV-02-C",
    "MAP/MSE/MMB/BV-13-I",
    "MAP/MSE/MMB/BV-14-I",
    "MAP/MSE/MMB/BV-15-I",
    "MAP/MSE/MMD/BV-02-I",
    "MAP/MSE/MMN/BV-02-I",
    "MAP/MSE/MMN/BV-04-I",
    "MAP/MSE/MMN/BV-07-I",
    "MAP/MSE/MMN/BV-14-I",
    "MAP/MSE/MMU/BV-02-I",
@@ -1575,6 +1575,7 @@
    "TSPC_MAP_0_6": true,
    "TSPC_MAP_0a_5": true,
    "TSPC_MAP_1_1": true,
    "TSPC_MAP_2_6c": false,
    "TSPC_MAP_3_1": true,
    "TSPC_MAP_3_1a": true,
    "TSPC_MAP_3_1b": true,
@@ -1594,7 +1595,7 @@
    "TSPC_MAP_3_5": true,
    "TSPC_MAP_3_5a": true,
    "TSPC_MAP_3_6b": true,
    "TSPC_MAP_3_6c": true,
    "TSPC_MAP_3_6c": false,
    "TSPC_MAP_3_7": true,
    "TSPC_MAP_3_7a": true,
    "TSPC_MAP_3_8": true,
+20 −1
Original line number Diff line number Diff line
@@ -20,6 +20,11 @@ import android.util.Log
import android.content.Context
import com.google.protobuf.Empty
import io.grpc.stub.StreamObserver
import android.provider.Telephony.*
import android.telephony.SmsManager
import android.telephony.SubscriptionManager
import android.telephony.TelephonyManager
import android.net.Uri
import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothDevice
import android.bluetooth.BluetoothManager
@@ -32,11 +37,13 @@ import pandora.AndroidProto.*
private const val TAG = "PandoraAndroidInternal"

@kotlinx.coroutines.ExperimentalCoroutinesApi
class AndroidInternal(context: Context) : AndroidImplBase() {
class AndroidInternal(val context: Context) : AndroidImplBase() {

  private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default)
  private val bluetoothManager = context.getSystemService(BluetoothManager::class.java)!!
  private val bluetoothAdapter = bluetoothManager.adapter
  private var telephonyManager = context.getSystemService(TelephonyManager::class.java)
  private val DEFAULT_MESSAGE_LEN = 130

  fun deinit() {
    scope.cancel()
@@ -61,4 +68,16 @@ class AndroidInternal(context: Context) : AndroidImplBase() {
      Empty.getDefaultInstance()
    }
  }

  override fun sendSMS(request: Empty, responseObserver: StreamObserver<Empty>) {
    grpcUnary<Empty>(scope, responseObserver) {
      val smsManager = SmsManager.getDefault()
      val defaultSmsSub = SubscriptionManager.getDefaultSmsSubscriptionId()
      telephonyManager = telephonyManager.createForSubscriptionId(defaultSmsSub)
      val avdPhoneNumber = telephonyManager.getLine1Number()

      smsManager.sendTextMessage(avdPhoneNumber, avdPhoneNumber, generateAlphanumericString(DEFAULT_MESSAGE_LEN), null, null)
      Empty.getDefaultInstance()
    }
  }
}
+0 −5
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ class MediaPlayerBrowserService : MediaBrowserService() {

  private lateinit var mediaSession: MediaSession
  private lateinit var playbackStateBuilder: PlaybackState.Builder
  private val alphanumeric = ('A'..'Z') + ('a'..'z') + ('0'..'9')
  private val mediaIdToChildren = mutableMapOf<String, MutableList<MediaItem>>()
  private var metadataItems = mutableMapOf<String, MediaMetadata>()
  private var queue = mutableListOf<MediaSession.QueueItem>()
@@ -132,10 +131,6 @@ class MediaPlayerBrowserService : MediaBrowserService() {
    )
  }

  private fun generateAlphanumericString(length: Int): String {
    return buildString { repeat(length) { append(alphanumeric.random()) } }
  }

  private val mSessionCallback: MediaSession.Callback =
    object : MediaSession.Callback() {
      override fun onPlay() {
+11 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ import pandora.AndroidProto.InternalConnectionRef
import pandora.HostProto.Connection

private const val TAG = "PandoraUtils"
private val alphanumeric = ('A'..'Z') + ('a'..'z') + ('0'..'9')

fun shell(cmd: String): String {
  val fd = InstrumentationRegistry.getInstrumentation().getUiAutomation().executeShellCommand(cmd)
@@ -340,3 +341,13 @@ fun buildAudioTrack(): AudioTrack? {
    .setBufferSizeInBytes(44100 * 2 * 2)
    .build()
}

/**
 * Generates Alpha-numeric string of given length.
 *
 * @param length required string size.
 * @return a generated string
 */
fun generateAlphanumericString(length: Int): String {
  return buildString { repeat(length) { append(alphanumeric.random()) } }
}
Loading