Refactor ApfV4Test

This is a no-op refactoring, which is preparation for follow-up
changes to add more apf test classes.

This includes:
1. Move initialization code to a base class, which setup a hotspot
   and a client connects to it, and enable doze mode to
   activate the apf.
2. Check whether send raw packet is supported before testing.

Test: m connectivity_multi_devices_snippet && \
  atest CtsConnectivityMultiDevicesTestCases
Test: atest NetworkStaticLibHostPythonTests
Bug: 350880989
Change-Id: I6376935883653182728e473e2f5533407d993d7b
This commit is contained in:
Junyu Lai 2024-07-04 11:09:52 +08:00
commit cf655869ba

View file

@ -142,6 +142,19 @@ def send_broadcast_empty_ethercat_packet(
send_raw_packet_downstream(ad, iface_name, packet)
def is_send_raw_packet_downstream_supported(
ad: android_device.AndroidDevice,
) -> bool:
try:
# Invoke the shell command with empty argument and see how NetworkStack respond.
# If supported, an IllegalArgumentException with help page will be printed.
send_raw_packet_downstream(ad, "", "")
except assert_utils.UnexpectedBehaviorError:
return True
except UnsupportedOperationException:
return False
def send_raw_packet_downstream(
ad: android_device.AndroidDevice,
iface_name: str,