CTS: test WifiNl80211Manager.sendMgmtFrame
Link probing is an optional feature gated by an overlay. Unfortunately, there is no public/system API that can be used to check if link probing is supported on the device. `adb shell cmd wifi send-link-probe` requires root, which is not supported by CTS. For devices that do not support link probing, this API could even throw an exception. Thus, this test does not have any expectations. Bug: 150978929 Test: atest android.net.wifi.nl80211.cts.WifiNl80211ManagerTest Change-Id: I13f9be5571c0eb7d64cc86bea5b7fd8addc1db5c
This commit is contained in:
@@ -42,11 +42,13 @@ import java.util.Arrays;
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class WifiNl80211ManagerTest {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
Context context = InstrumentationRegistry.getInstrumentation().getContext();
|
||||
mContext = InstrumentationRegistry.getInstrumentation().getContext();
|
||||
// skip tests if Wifi is not supported
|
||||
assumeTrue(WifiFeature.isWifiSupported(context));
|
||||
assumeTrue(WifiFeature.isWifiSupported(mContext));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -64,4 +66,19 @@ public class WifiNl80211ManagerTest {
|
||||
.isEqualTo(Arrays.asList(ScanResult.CIPHER_NONE, ScanResult.CIPHER_TKIP));
|
||||
assertThat(securityType.groupCipher).isEqualTo(ScanResult.CIPHER_CCMP);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendMgmtFrame() {
|
||||
try {
|
||||
WifiNl80211Manager manager = mContext.getSystemService(WifiNl80211Manager.class);
|
||||
manager.sendMgmtFrame("wlan0", new byte[]{}, -1, Runnable::run,
|
||||
new WifiNl80211Manager.SendMgmtFrameCallback() {
|
||||
@Override
|
||||
public void onAck(int elapsedTimeMs) {}
|
||||
|
||||
@Override
|
||||
public void onFailure(int reason) {}
|
||||
});
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user