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

Commit 5d3a1fd3 authored by Martin Brabham's avatar Martin Brabham
Browse files

Wire up test to disconnect callback

Bug: 164495896
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Change-Id: I8bff5eab60ce5d24ed83c271b04a294c67fafc62
parent dd8f893a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ class PySecurity(Closable):
        self._bond_event_stream = EventStream(self._device.security.FetchBondEvents(empty_proto.Empty()))
        self._enforce_security_policy_stream = EventStream(
            self._device.security.FetchEnforceSecurityPolicyEvents(empty_proto.Empty()))
        self._disconnect_event_stream = EventStream(self._device.security.FetchDisconnectEvents(empty_proto.Empty()))

    def create_bond(self, address, type):
        """
@@ -180,6 +181,13 @@ class PySecurity(Closable):
        assertThat(self._enforce_security_policy_stream).emits(
            lambda event: event.result == expected_enforce_security_event or logging.info(event.result))

    def wait_for_disconnect_event(self):
        """
            The Address is expected to be returned
        """
        logging.info("DUT: Waiting for Disconnect Event")
        assertThat(self._disconnect_event_stream).emits(lambda event: 1 == 1)

    def enforce_security_policy(self, address, type, policy):
        """
            Call to enforce classic security policy
@@ -193,3 +201,4 @@ class PySecurity(Closable):
        safeClose(self._ui_event_stream)
        safeClose(self._bond_event_stream)
        safeClose(self._enforce_security_policy_stream)
        safeClose(self._disconnect_event_stream)
+6 −0
Original line number Diff line number Diff line
@@ -206,5 +206,11 @@ class CertSecurity(PySecurity):
        """
        pass

    def wait_for_disconnect_event(self):
        """
            Cert side needs to pass
        """
        pass

    def close(self):
        safeClose(self._hci)
+2 −1
Original line number Diff line number Diff line
@@ -274,4 +274,5 @@ class SecurityTest(GdBaseTestClass):
                                self.cert_security.remove_bond(self.dut_security.get_address(),
                                                               common.BluetoothAddressTypeEnum.PUBLIC_DEVICE_ADDRESS)

                                time.sleep(.1)
                                self.dut_security.wait_for_disconnect_event()
                                self.cert_security.wait_for_disconnect_event()