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

Commit 3bf960ff authored by Charlie Boutier's avatar Charlie Boutier Committed by Automerger Merge Worker
Browse files

Merge "[PTS-Bot]: Added 44 PBAP test cases" am: ac457726 am: 05778898

parents 2976074c 05778898
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ from mmi2grpc.hid import HIDProxy
from mmi2grpc.hogp import HOGPProxy
from mmi2grpc.l2cap import L2CAPProxy
from mmi2grpc.map import MAPProxy
from mmi2grpc.pbap import PBAPProxy
from mmi2grpc.rfcomm import RFCOMMProxy
from mmi2grpc.sdp import SDPProxy
from mmi2grpc.sm import SMProxy
@@ -79,6 +80,7 @@ class IUT:
        self._hogp = None
        self._l2cap = None
        self._map = None
        self._pbap = None
        self._rfcomm = None
        self._sdp = None
        self._sm = None
@@ -111,6 +113,7 @@ class IUT:
        self._hid = None
        self._hogp = None
        self._map = None
        self._pbap = None
        self._rfcomm = None
        self._sdp = None
        self._sm = None
@@ -229,6 +232,11 @@ class IUT:
            if not self._map:
                self._map = MAPProxy(grpc.insecure_channel(f"localhost:{self.pandora_server_port}"))
            return self._map.interact(test, interaction, description, pts_address)
        # Instantiates PBAP proxy and reroutes corresponding MMIs to it.
        if profile in ("PBAP"):
            if not self._pbap:
                self._pbap = PBAPProxy(grpc.insecure_channel(f"localhost:{self.pandora_server_port}"))
            return self._pbap.interact(test, interaction, description, pts_address)
        # Handles RFCOMM MMIs.
        if profile in ("RFCOMM"):
            if not self._rfcomm:
+158 −0
Original line number Diff line number Diff line
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""PBAP proxy module."""

from typing import Optional

from grpc import RpcError

from mmi2grpc._helpers import assert_description, match_description
from mmi2grpc._proxy import ProfileProxy
from pandora_experimental.host_grpc import Host
from pandora_experimental.host_pb2 import Connection
from pandora_experimental._android_grpc import Android
from pandora_experimental._android_pb2 import AccessType
from pandora_experimental.pbap_grpc import PBAP


class PBAPProxy(ProfileProxy):
    """PBAP proxy.

    Implements PBAP PTS MMIs.
    """

    connection: Optional[Connection] = None

    def __init__(self, channel):
        super().__init__(channel)

        self.host = Host(channel)
        self.pbap = PBAP(channel)
        self._android = Android(channel)

        self.connection = None

    @assert_description
    def TSC_MMI_iut_connectable(self, **kwargs):
        """
        Click OK when the IUT becomes connectable.
        """

        return "OK"

    @assert_description
    def TSC_OBEX_MMI_iut_accept_slc_connect_l2cap(self, pts_addr: bytes, **kwargs):
        """
        Please accept the l2cap channel connection for an OBEX connection.
        """
        self._android.SetAccessPermission(address=pts_addr, access_type=AccessType.ACCESS_PHONEBOOK)
        self.connection = self.host.WaitConnection(address=pts_addr).connection

        return "OK"

    @assert_description
    def TSC_OBEX_MMI_iut_accept_connect(self, test: str, pts_addr: bytes, **kwargs):
        """
        Please accept the OBEX CONNECT REQ.
        """
        if ("PBAP/PSE/GOEP/BC/BV-03-I" in test):
            if self.connection is None:
                self._android.SetAccessPermission(address=pts_addr, access_type=AccessType.ACCESS_PHONEBOOK)
                self.connection = self.host.WaitConnection(address=pts_addr).connection

        return "OK"

    @assert_description
    def TSC_OBEX_MMI_iut_accept_set_path(self, **kwargs):
        """
        Please accept the SET_PATH command.
        """

        return "OK"

    @assert_description
    def TSC_MMI_verify_vcard(self, **kwargs):
        """
        Verify the content vcard sent by the IUT is accurate.
        """

        return "OK"

    @match_description
    def TSC_MMI_verify_phonebook_size(self, **kwargs):
        """
        Verify that the phonebook size = (?P<size>[0-9]+)

        Note: Owner's card is also
        included in the count.
        """

        return "OK"

    @assert_description
    def TSC_OBEX_MMI_iut_reject_action(self, **kwargs):
        """
        Take action to reject the ACTION command sent by PTS.
        """

        return "OK"

    @assert_description
    def TSC_OBEX_MMI_iut_reject_session(self, **kwargs):
        """
        Take action to reject the SESSION command sent by PTS.
        """

        return "OK"

    @assert_description
    def TSC_OBEX_MMI_iut_accept_get_srm(self, **kwargs):
        """
        Please accept the GET REQUEST with an SRM ENABLED header.
        """

        return "OK"

    @assert_description
    def TSC_OBEX_MMI_iut_accept_disconnect(self, **kwargs):
        """
        Please accept the OBEX DISCONNECT REQ command.
        """

        return "OK"

    @assert_description
    def TSC_OBEX_MMI_iut_accept_put(self, **kwargs):
        """
        Please accept the PUT REQUEST.
        """

        return "OK"

    @assert_description
    def TSC_MMI_verify_user_confirmation(self, **kwargs):
        """
        Click Ok if the Implementation Under Test (IUT) was prompted to accept
        the PBAP connection.
        """

        return "OK"

    @match_description
    def TSC_MMI_verify_newmissedcall(self, **kwargs):
        """
         Verify that the new missed calls = (?P<size>[0-9]+)
        """

        return "OK"
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
        <option name="profile" value="HOGP" />
        <option name="profile" value="L2CAP/LE" />
        <option name="profile" value="MAP" />
        <option name="profile" value="PBAP/PSE" />
        <option name="profile" value="RFCOMM" />
        <option name="profile" value="SDP" />
        <option name="profile" value="SM" />
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
        <option name="profile" value="HOGP" />
        <option name="profile" value="L2CAP/LE" />
        <option name="profile" value="MAP" />
        <option name="profile" value="PBAP/PSE" />
        <option name="profile" value="SDP" />
        <option name="profile" value="SM" />
    </test>
+47 −0
Original line number Diff line number Diff line
@@ -352,6 +352,50 @@
    "MAP/MSE/MSM/BV-06-I",
    "MAP/MSE/MSM/BV-07-I",
    "MAP/MSE/MSM/BV-08-I",
    "PBAP/PSE/GOEP/BC/BV-03-I",
    "PBAP/PSE/GOEP/CON/BV-02-C",
    "PBAP/PSE/GOEP/ROB/BV-01-C",
    "PBAP/PSE/GOEP/ROB/BV-02-C",
    "PBAP/PSE/GOEP/SRM/BI-03-C",
    "PBAP/PSE/GOEP/SRM/BI-05-C",
    "PBAP/PSE/GOEP/SRM/BV-08-C",
    "PBAP/PSE/GOEP/SRMP/BI-02-C",
    "PBAP/PSE/GOEP/SRMP/BV-02-C",
    "PBAP/PSE/PBB/BI-01-C",
    "PBAP/PSE/PBB/BI-07-C",
    "PBAP/PSE/PBB/BV-06-C",
    "PBAP/PSE/PBB/BV-07-C",
    "PBAP/PSE/PBB/BV-08-C",
    "PBAP/PSE/PBB/BV-09-C",
    "PBAP/PSE/PBB/BV-10-C",
    "PBAP/PSE/PBB/BV-11-C",
    "PBAP/PSE/PBB/BV-12-C",
    "PBAP/PSE/PBB/BV-19-C",
    "PBAP/PSE/PBB/BV-20-C",
    "PBAP/PSE/PBB/BV-21-C",
    "PBAP/PSE/PBB/BV-22-C",
    "PBAP/PSE/PBB/BV-23-C",
    "PBAP/PSE/PBB/BV-31-C",
    "PBAP/PSE/PBD/BI-01-C",
    "PBAP/PSE/PBD/BV-02-C",
    "PBAP/PSE/PBD/BV-03-C",
    "PBAP/PSE/PBD/BV-17-C",
    "PBAP/PSE/PBD/BV-24-C",
    "PBAP/PSE/PBD/BV-25-C",
    "PBAP/PSE/PBD/BV-26-C",
    "PBAP/PSE/PBD/BV-27-C",
    "PBAP/PSE/PBD/BV-28-C",
    "PBAP/PSE/PBD/BV-36-C",
    "PBAP/PSE/PBF/BV-01-I",
    "PBAP/PSE/PBF/BV-02-I",
    "PBAP/PSE/PBF/BV-03-I",
    "PBAP/PSE/PDF/BV-01-I",
    "PBAP/PSE/PDF/BV-06-I",
    "PBAP/PSE/SSM/BI-02-C",
    "PBAP/PSE/SSM/BV-03-C",
    "PBAP/PSE/SSM/BV-05-C",
    "PBAP/PSE/SSM/BV-08-I",
    "PBAP/PSE/SSM/BV-11-C",
    "RFCOMM/DEVA/RFC/BV-01-C",
    "RFCOMM/DEVB/RFC/BV-02-C",
    "RFCOMM/DEVA-DEVB/RFC/BV-03-C",
@@ -680,6 +724,7 @@
    "MAP/MSE/MMN/BV-07-I",
    "MAP/MSE/MMN/BV-14-I",
    "MAP/MSE/MMU/BV-02-I",
    "PBAP/PSE/SSM/BV-07-C",
    "RFCOMM/DEVA-DEVB/RFC/BV-21-C",
    "RFCOMM/DEVA-DEVB/RFC/BV-22-C",
    "SM/CEN/PKE/BV-01-C",
@@ -1532,6 +1577,8 @@
    "TSPC_PBAP_9_7": true,
    "TSPC_PBAP_9_12": true,
    "TSPC_PBAP_9_13a": true,
    "TSPC_PBAP_9_13d": true,
    "TSPC_PBAP_9_13e": true,
    "TSPC_PBAP_9_14a": true,
    "TSPC_PBAP_9_14b": true,
    "TSPC_PBAP_9a_3": true,
Loading