Skip to content

Commit

Permalink
Merge branch 'google:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
zxzxwu authored Oct 24, 2023
2 parents 742a3aa + 8e5c0a8 commit d365ae0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions avatar/cases/le_host_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class LeHostTest(base_test.BaseTestClass): # type: ignore[misc]
def setup_class(self) -> None:
self.devices = PandoraDevices(self)
self.dut, self.ref, *_ = self.devices
self.scan_timeout = float(self.user_params.get('scan_timeout') or 15.0) # type: ignore

# Enable BR/EDR mode for Bumble devices.
for device in self.devices:
Expand Down Expand Up @@ -113,7 +114,7 @@ def test_scan(
own_address_type=PUBLIC,
)

scan = self.dut.host.Scan(legacy=False, passive=False, timeout=5.0)
scan = self.dut.host.Scan(legacy=False, passive=False, timeout=self.scan_timeout)
report = next((x for x in scan if x.public == self.ref.address))
try:
report = next((x for x in scan if x.public == self.ref.address))
Expand Down Expand Up @@ -173,7 +174,7 @@ def test_scan_response_data(self, data: Dict[str, Any]) -> None:
own_address_type=PUBLIC,
)

scan = self.dut.host.Scan(legacy=False, passive=False)
scan = self.dut.host.Scan(legacy=False, passive=False, timeout=self.scan_timeout)
report = next((x for x in scan if x.public == self.ref.address))

scan.cancel()
Expand All @@ -198,13 +199,13 @@ async def test_connect(self, ref_address_type: OwnAddressType) -> None:
data=DataTypes(manufacturer_specific_data=b'pause cafe'),
)

scan = self.dut.aio.host.Scan(own_address_type=RANDOM)
scan = self.dut.aio.host.Scan(own_address_type=RANDOM, timeout=self.scan_timeout)
ref = await anext((x async for x in scan if x.data.manufacturer_specific_data == b'pause cafe'))
scan.cancel()

ref_dut_res, dut_ref_res = await asyncio.gather(
anext(aiter(advertise)),
self.dut.aio.host.ConnectLE(**ref.address_asdict(), own_address_type=RANDOM),
self.dut.aio.host.ConnectLE(**ref.address_asdict(), own_address_type=RANDOM, timeout=self.scan_timeout),
)
assert_equal(dut_ref_res.result_variant(), 'connection')
dut_ref, ref_dut = dut_ref_res.connection, ref_dut_res.connection
Expand All @@ -226,13 +227,13 @@ async def test_disconnect(self, ref_address_type: OwnAddressType) -> None:
data=DataTypes(manufacturer_specific_data=b'pause cafe'),
)

scan = self.dut.aio.host.Scan(own_address_type=RANDOM)
scan = self.dut.aio.host.Scan(own_address_type=RANDOM, timeout=self.scan_timeout)
ref = await anext((x async for x in scan if x.data.manufacturer_specific_data == b'pause cafe'))
scan.cancel()

ref_dut_res, dut_ref_res = await asyncio.gather(
anext(aiter(advertise)),
self.dut.aio.host.ConnectLE(**ref.address_asdict(), own_address_type=RANDOM),
self.dut.aio.host.ConnectLE(**ref.address_asdict(), own_address_type=RANDOM, timeout=self.scan_timeout),
)
assert_equal(dut_ref_res.result_variant(), 'connection')
dut_ref, ref_dut = dut_ref_res.connection, ref_dut_res.connection
Expand Down
2 changes: 1 addition & 1 deletion avatar/cases/le_security_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def on_done(_: Any) -> None:

connect_and_pair_task.add_done_callback(on_done)

ref_ev = await asyncio.wait_for(ref_pairing_fut, timeout=5.0)
ref_ev = await asyncio.wait_for(ref_pairing_fut, timeout=15.0)
self.ref.log.info(f'REF pairing event: {ref_ev.method_variant()}')

dut_ev_answer, ref_ev_answer = None, None
Expand Down
2 changes: 1 addition & 1 deletion avatar/cases/security_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def on_done(_: Any) -> None:

connect_and_pair_task.add_done_callback(on_done)

ref_ev = await asyncio.wait_for(ref_pairing_fut, timeout=5.0)
ref_ev = await asyncio.wait_for(ref_pairing_fut, timeout=15.0)
self.ref.log.info(f'REF pairing event: {ref_ev.method_variant()}')

dut_ev_answer, ref_ev_answer = None, None
Expand Down

0 comments on commit d365ae0

Please sign in to comment.