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

Commit 19e1bc3f authored by Zach Johnson's avatar Zach Johnson
Browse files

Simplify le random address setting for tests

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --host
Change-Id: I59e6926bb00b377b3580742800fbe2743c067181
parent 6195d630
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -147,6 +147,9 @@ class PyHal(Closable):
        assertThat(self.hci_event_stream).emits(read_bd_addr)
        return read_bd_addr.get().GetBdAddr()

    def set_random_le_address(self, addr):
        self.send_hci_command(hci_packets.LeSetRandomAddressBuilder(addr))

    def reset(self):
        self.send_hci_command(hci_packets.ResetBuilder())
        assertThat(self.hci_event_stream).emits(HciMatchers.CommandComplete(OpCode.RESET))
+3 −3
Original line number Diff line number Diff line
@@ -80,8 +80,8 @@ class SimpleHalTest(GdBaseTestClass):
                                                             )

    def test_le_ad_scan_cert_advertises(self):
        self.dut_hal.set_random_le_address('0D:05:04:03:02:01')
        # DUT scans
        self.dut_hal.send_hci_command(hci_packets.LeSetRandomAddressBuilder('0D:05:04:03:02:01'))
        phy_scan_params = hci_packets.PhyScanParameters()
        phy_scan_params.le_scan_interval = 6553
        phy_scan_params.le_scan_window = 6553
@@ -116,7 +116,7 @@ class SimpleHalTest(GdBaseTestClass):

    def test_le_connection_dut_advertises(self):
        # Cert Connects
        self.cert_hal.send_hci_command(hci_packets.LeSetRandomAddressBuilder('0C:05:04:03:02:01'))
        self.cert_hal.set_random_le_address('0C:05:04:03:02:01')
        self.cert_hal.initiate_le_connection('0D:05:04:03:02:01')

        # DUT Advertises
@@ -135,7 +135,7 @@ class SimpleHalTest(GdBaseTestClass):
        assertThat(self.dut_hal.get_acl_stream()).emits(lambda packet: b'SomeMoreAclData' in packet.payload)

    def test_le_connect_list_connection_cert_advertises(self):
        self.dut_hal.send_hci_command(hci_packets.LeSetRandomAddressBuilder('0D:05:04:03:02:01'))
        self.dut_hal.set_random_le_address('0D:05:04:03:02:01')
        self.dut_hal.add_to_connect_list('0C:05:04:03:02:01')
        self.dut_hal.initiate_le_connection_by_connect_list('BA:D5:A4:A3:A2:A1')