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

Commit b48dcd4c authored by Hui Peng's avatar Hui Peng Committed by Bhakthavatsala Raghavendra
Browse files

Add ble/sc pairing tests (no_output_no_input)

Bug: 277282212
Test: atest avatar
Flag: EXEMPT, Tests
Change-Id: I091456bb3a26a6184d1e00aa4c3d88e66a45f8f5
parent b8d82a99
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ from pairing.ble.sc.display_output_and_keyboard_input.tests import BLESCDisplayK
from pairing.ble.sc.display_output_and_yes_no_input.tests import BLESCDisplayYesNoTestClass
from pairing.ble.sc.display_output_only.tests import BLESCDisplayOnlyTestClass
from pairing.ble.sc.keyboard_input_only.tests import BLESCKbdOnlyTestClass
from pairing.ble.sc.no_output_no_input.tests import BLESCNoInputNoOutputTestClass


from pairing.smp_test import SmpTest
@@ -41,16 +42,17 @@ _test_class_list = [
    BLELegDisplayOnlyTestClass,
    BLELegDisplayYesNoTestClass,
    BLELegKbdOnlyTestClass,
    BLELegNoInputNoOutputTestClass,
    # BLELegNoInputNoOutputTestClass,
    BLESCDisplayKbdTestClass,
    BLESCDisplayOnlyTestClass,
    # BLESCDisplayOnlyTestClass,
    BLESCDisplayYesNoTestClass,
    BLESCKbdOnlyTestClass,
    # BLESCKbdOnlyTestClass,
    BLESCNoInputNoOutputTestClass,
    BREDRDisplayYesNoTestClass,
    BREDRDisplayOnlyTestClass,
    # BREDRKeyboardOnlyTestClass,
    BREDRNoOutputNoInputTestClass,
    BREDRLegacyTestClass,
    ServiceAccessTempBondingTest,
    # ServiceAccessTempBondingTest,
    SmpTest,
]
+63 −0
Original line number Diff line number Diff line
# Copyright 2024 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.

import logging

from mobly.asserts import assert_equal

from pairing.ble.test_base import BLEPairTestBaseWithGeneralAndDedicatedPairingTests

from pandora.security_pb2 import PairingEventAnswer

class BLESCNoInputNoOutputTestClass(BLEPairTestBaseWithGeneralAndDedicatedPairingTests):

    def _setup_devices(self) -> None:
        self.ref.config.setdefault('le_enabled', True)

        # Explicitly disable BR/EDR
        self.ref.config.setdefault('classic_enabled', False)
        self.ref.config.setdefault('classic_ssp_enabled', False)
        self.ref.config.setdefault('classic_sc_enabled', False)

        self.ref.config.setdefault(
            'server',
            {
                # legacy pairing
                'pairing_sc_enable': True,
                'pairing_mitm_enable': True,
                'pairing_bonding_enable': True,
                # Android IO CAP: Display_KBD
                # Ref IO CAP:
                'io_capability': 'no_output_no_input',
            },
        )

    async def accept_pairing(self):
        # we just need to confirm on Android
        android_ev = await anext(self.android_pairing_stream)
        logging.debug(f'received android_ev.method_variant():{android_ev.method_variant()}')

        ans = PairingEventAnswer(event=android_ev, confirm=True)
        self.android_pairing_stream.send_nowait(ans)

        if (self.responder_pairing_event_stream == self.android_pairing_stream) and (self.acl_initiator == self.dut):
            # in test_dedicated_pairing_dut_initiate_2
            # there is an additional user confirmation
            android_ev = await anext(self.android_pairing_stream)
            ans = PairingEventAnswer(event=android_ev, confirm=True)
            self.android_pairing_stream.send_nowait(ans)

        bumble_ev = await anext(self.bumble_pairing_stream)
        ans = PairingEventAnswer(event=bumble_ev, confirm=True)
        self.bumble_pairing_stream.send_nowait(ans)