From 59bf9e2a77b03a6b37328c0140059bec17fdccc8 Mon Sep 17 00:00:00 2001 From: Martin Brabham Date: Fri, 13 Nov 2020 16:06:35 -0800 Subject: [PATCH] CertSecurity: Add accept_oob_pairing function Bug: 162984360 Tag: #gd-refactor Test: cert/run --host SecurityTest Change-Id: I27e6b6ceedd0fc001f25222db6f0f3189c006e3c --- gd/security/cert/cert_security.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gd/security/cert/cert_security.py b/gd/security/cert/cert_security.py index 1912aa165..c56565214 100644 --- a/gd/security/cert/cert_security.py +++ b/gd/security/cert/cert_security.py @@ -263,6 +263,24 @@ class CertSecurity(PySecurity): logging.info("Cert: Waiting for SIMPLE_PAIRING_COMPLETE") assertThat(self._hci_event_stream).emits(HciMatchers.SimplePairingComplete()) + def accept_oob_pairing(self, dut_address): + logging.info("Cert: Waiting for IO_CAPABILITY_RESPONSE") + assertThat(self._hci_event_stream).emits(HciMatchers.IoCapabilityResponse()) + logging.info("Cert: Waiting for IO_CAPABILITY_REQUEST") + assertThat(self._hci_event_stream).emits(HciMatchers.IoCapabilityRequest()) + logging.info("Cert: Sending IO_CAPABILITY_REQUEST_REPLY") + oob_data_present = hci_packets.OobDataPresent.NOT_PRESENT + self._enqueue_hci_command( + hci_packets.IoCapabilityRequestReplyBuilder( + dut_address.decode('utf8'), self._io_caps, oob_data_present, self._auth_reqs), True) + assertThat(self._hci_event_stream).emits(HciMatchers.CommandComplete()) + logging.info("Cert: Waiting for SIMPLE_PAIRING_COMPLETE") + ssp_complete_capture = HciCaptures.SimplePairingCompleteCapture() + assertThat(self._hci_event_stream).emits(ssp_complete_capture) + ssp_complete = ssp_complete_capture.get() + logging.info(ssp_complete.GetStatus()) + assertThat(ssp_complete.GetStatus()).isEqualTo(hci_packets.ErrorCode.SUCCESS) + def on_user_input(self, dut_address, reply_boolean, expected_ui_event): """ Cert doesn't need the test to respond to the ui event -- 2.11.0