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

Commit 89ca0a33 authored by Fahad Afroze's avatar Fahad Afroze Committed by Thomas Girardier
Browse files

[PTS-Bot]: Added 7 OPP/SR test cases

Added opp.py file
Updated _android.proto and AndroidInternal.kt files
Added AcceptIncomingFile function in AndroidInternal.kt using uiautomator.

Test: atest pts-bot:OPP -v
Bug: 245578454
Ignore-AOSP-First: cherry-pick from AOSP
Change-Id: If2ab94f8033035ddf7b40a1a5acdc58b8f272acc
Merged-In: If2ab94f8033035ddf7b40a1a5acdc58b8f272acc
parent 0c46bbae
Loading
Loading
Loading
Loading
+8 −0
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.opp import OPPProxy
from mmi2grpc.pbap import PBAPProxy
from mmi2grpc.rfcomm import RFCOMMProxy
from mmi2grpc.sdp import SDPProxy
@@ -80,6 +81,7 @@ class IUT:
        self._hogp = None
        self._l2cap = None
        self._map = None
        self._opp = None
        self._pbap = None
        self._rfcomm = None
        self._sdp = None
@@ -113,6 +115,7 @@ class IUT:
        self._hid = None
        self._hogp = None
        self._map = None
        self._opp = None
        self._pbap = None
        self._rfcomm = None
        self._sdp = None
@@ -232,6 +235,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)
        # Handles OPP MMIs.
        if profile in ("OPP"):
            if not self._opp:
                self._opp = OPPProxy(grpc.insecure_channel(f"localhost:{self.pandora_server_port}"))
            return self._opp.interact(test, interaction, description, pts_address)
        # Instantiates PBAP proxy and reroutes corresponding MMIs to it.
        if profile in ("PBAP"):
            if not self._pbap:
+118 −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.
"""OPP proxy module."""

from typing import Optional

from mmi2grpc._helpers import assert_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


class OPPProxy(ProfileProxy):
    """OPP proxy.

    Implements OPP PTS MMIs.
    """
    connection: Optional[Connection] = None

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

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

        self.connection = None

    @assert_description
    def TSC_OBEX_MMI_iut_accept_connect_OPP(self, pts_addr: bytes, **kwargs):
        """
        Please accept the OBEX CONNECT REQ command for OPP.
        """
        if self.connection is None:
            self.connection = self.host.WaitConnection(address=pts_addr).connection

        return "OK"

    @assert_description
    def TSC_OPP_mmi_user_action_remove_object(self, **kwargs):
        """
        If necessary take action to remove any file(s) named 'BC_BV01.bmp' from
        the IUT.  

        Press 'OK' to confirm that the file is not present on the
        IUT.
        """

        return "OK"

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

        return "OK"

    @assert_description
    def TSC_OPP_mmi_user_verify_does_object_exist(self, **kwargs):
        """
        Does the IUT now contain the following files?

        BC_BV01.bmp

        Note: If
        TSPX_supported_extension is not .bmp, the file content of the file will
        not be formatted for the TSPX_supported extension, this is normal.
        """

        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.connection = self.host.WaitConnection(address=pts_addr).connection

        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_accept_disconnect(self, **kwargs):
        """
         Please accept the OBEX DISCONNECT REQ command.
        """

        return "OK"

    @assert_description
    def TSC_OBEX_MMI_iut_accept_slc_disconnect(self, **kwargs):
        """
         Please accept the disconnection of the transport channel.
        """

        return "OK"
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ java_library_static {
    static_libs: [
        "androidx.test.runner",
        "androidx.test.core",
        "androidx.test.uiautomator_uiautomator",
        "grpc-java-netty-shaded-test",
        "grpc-java-lite",
        "guava",
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
        <option name="profile" value="L2CAP/COS" />
        <option name="profile" value="L2CAP/LE" />
        <option name="profile" value="MAP" />
        <option name="profile" value="OPP" />
        <option name="profile" value="PBAP/PSE" />
        <option name="profile" value="RFCOMM" />
        <option name="profile" value="SDP" />
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
        <option name="profile" value="L2CAP/COS" />
        <option name="profile" value="L2CAP/LE" />
        <option name="profile" value="MAP" />
        <option name="profile" value="OPP" />
        <option name="profile" value="PBAP/PSE" />
        <option name="profile" value="RFCOMM" />
        <option name="profile" value="SDP" />
Loading