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

Commit 487b80eb authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "GD-SL4A: Add repeated connection test for background connections"

parents 734c7848 2a2172d4
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#   limitations under the License.
import time
from abc import ABC, abstractmethod
import logging


class Closable(ABC):
@@ -23,11 +24,17 @@ class Closable(ABC):
        return self

    def __exit__(self, type, value, traceback):
        try:
            self.close()
        except Exception:
            logging.warning("Failed to close or already closed")
        return traceback is None

    def __del__(self):
        try:
            self.close()
        except Exception:
            logging.warning("Failed to close or already closed")

    @abstractmethod
    def close(self):
+5 −2
Original line number Diff line number Diff line
@@ -55,9 +55,12 @@ class PyLeAclManagerAclConnection(IEventStream, Closable):
        safeClose(self.connection_event_stream)
        safeClose(self.acl_stream)

    def wait_for_disconnection_complete(self):
    def disconnect(self):
        self.le_acl_manager.Disconnect(le_acl_manager_facade.LeHandleMsg(handle=self.handle))

    def wait_for_disconnection_complete(self, timeout=timedelta(seconds=30)):
        disconnection_complete = HciCaptures.DisconnectionCompleteCapture()
        assertThat(self.connection_event_stream).emits(disconnection_complete)
        assertThat(self.connection_event_stream).emits(disconnection_complete, timeout=timeout)
        self.disconnect_reason = disconnection_complete.get().GetReason()

    def send(self, data):