summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2019-11-24 10:43:05 -0800
committerEtan Cohen <etancohen@google.com>2019-12-09 11:02:16 -0800
commit39f971749c0269d59ec513b60bce00884fff00f3 (patch)
tree87916824f63d842508186f2bef5b136039720372 /tests
parent8d78ed903562038aa3fff47337aeef5416858750 (diff)
[WIFI][MAINLINE] Transition WificondControl interfaces: SendMgmtFrameCallback
Transition WificondControl public interfaces to that class itself. Preparation for the class being extracted to an official API. Classes shifted: SendMgmtFrameCallback Bug: 140062898 Test: atest android.net.wifi Test: atest com.android.server.wifi Change-Id: I5b19ab8d55e1409cdd47468bb53b0303255d540b
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/LinkProbeManagerTest.java12
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WificondControlTest.java21
4 files changed, 24 insertions, 21 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/LinkProbeManagerTest.java b/tests/wifitests/src/com/android/server/wifi/LinkProbeManagerTest.java
index 74396a02e..0d46220bb 100644
--- a/tests/wifitests/src/com/android/server/wifi/LinkProbeManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/LinkProbeManagerTest.java
@@ -134,8 +134,8 @@ public class LinkProbeManagerTest extends WifiBaseTest {
mTimeMs += timeDelta;
when(mClock.getElapsedSinceBootMillis()).thenReturn(mTimeMs);
mLinkProbeManager.updateConnectionStats(mWifiInfo, TEST_IFACE_NAME);
- ArgumentCaptor<WifiNative.SendMgmtFrameCallback> callbackCaptor =
- ArgumentCaptor.forClass(WifiNative.SendMgmtFrameCallback.class);
+ ArgumentCaptor<WificondControl.SendMgmtFrameCallback> callbackCaptor =
+ ArgumentCaptor.forClass(WificondControl.SendMgmtFrameCallback.class);
verify(mWifiNative).probeLink(eq(TEST_IFACE_NAME), any(), callbackCaptor.capture(),
anyInt());
ArgumentCaptor<String> experimentIdCaptor = ArgumentCaptor.forClass(String.class);
@@ -177,14 +177,14 @@ public class LinkProbeManagerTest extends WifiBaseTest {
mTimeMs += timeDelta;
when(mClock.getElapsedSinceBootMillis()).thenReturn(mTimeMs);
mLinkProbeManager.updateConnectionStats(mWifiInfo, TEST_IFACE_NAME);
- ArgumentCaptor<WifiNative.SendMgmtFrameCallback> callbackCaptor =
- ArgumentCaptor.forClass(WifiNative.SendMgmtFrameCallback.class);
+ ArgumentCaptor<WificondControl.SendMgmtFrameCallback> callbackCaptor =
+ ArgumentCaptor.forClass(WificondControl.SendMgmtFrameCallback.class);
verify(mWifiNative).probeLink(eq(TEST_IFACE_NAME), any(), callbackCaptor.capture(),
anyInt());
- callbackCaptor.getValue().onFailure(WifiNative.SEND_MGMT_FRAME_ERROR_NO_ACK);
+ callbackCaptor.getValue().onFailure(WificondControl.SEND_MGMT_FRAME_ERROR_NO_ACK);
verify(mWifiMetrics).logLinkProbeFailure(timeDelta, rssi, linkSpeed,
- WifiNative.SEND_MGMT_FRAME_ERROR_NO_ACK);
+ WificondControl.SEND_MGMT_FRAME_ERROR_NO_ACK);
}
/**
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 4ee6c79a4..ec136ed3b 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -3411,13 +3411,13 @@ public class WifiMetricsTest extends WifiBaseTest {
public void testLogLinkProbeMetrics() throws Exception {
mWifiMetrics.logLinkProbeSuccess(10000, -75, 50, 5);
mWifiMetrics.logLinkProbeFailure(30000, -80, 10,
- WifiNative.SEND_MGMT_FRAME_ERROR_NO_ACK);
+ WificondControl.SEND_MGMT_FRAME_ERROR_NO_ACK);
mWifiMetrics.logLinkProbeSuccess(3000, -71, 160, 12);
mWifiMetrics.logLinkProbeFailure(40000, -80, 6,
- WifiNative.SEND_MGMT_FRAME_ERROR_NO_ACK);
+ WificondControl.SEND_MGMT_FRAME_ERROR_NO_ACK);
mWifiMetrics.logLinkProbeSuccess(5000, -73, 160, 10);
mWifiMetrics.logLinkProbeFailure(2000, -78, 6,
- WifiNative.SEND_MGMT_FRAME_ERROR_TIMEOUT);
+ WificondControl.SEND_MGMT_FRAME_ERROR_TIMEOUT);
dumpProtoAndDeserialize();
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
index 726dadda6..c13a5fc90 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
@@ -32,7 +32,7 @@ import android.os.INetworkManagementService;
import androidx.test.filters.SmallTest;
-import com.android.server.wifi.WifiNative.SendMgmtFrameCallback;
+import com.android.server.wifi.WificondControl.SendMgmtFrameCallback;
import org.junit.Before;
import org.junit.Test;
@@ -740,7 +740,7 @@ public class WifiNativeTest extends WifiBaseTest {
mWifiNative.probeLink(WIFI_IFACE_NAME, MacAddress.fromString(TEST_BSSID_STR),
mSendMgmtFrameCallback, TEST_MCS_RATE);
- verify(mSendMgmtFrameCallback).onFailure(WifiNative.SEND_MGMT_FRAME_ERROR_UNKNOWN);
+ verify(mSendMgmtFrameCallback).onFailure(WificondControl.SEND_MGMT_FRAME_ERROR_UNKNOWN);
verify(mWificondControl, never()).sendMgmtFrame(any(), any(), any(), anyInt());
}
@@ -753,7 +753,7 @@ public class WifiNativeTest extends WifiBaseTest {
mWifiNative.probeLink(WIFI_IFACE_NAME, null, mSendMgmtFrameCallback, TEST_MCS_RATE);
- verify(mSendMgmtFrameCallback).onFailure(WifiNative.SEND_MGMT_FRAME_ERROR_UNKNOWN);
+ verify(mSendMgmtFrameCallback).onFailure(WificondControl.SEND_MGMT_FRAME_ERROR_UNKNOWN);
verify(mWificondControl, never()).sendMgmtFrame(any(), any(), any(), anyInt());
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java
index 702003952..1b7a7a1ce 100644
--- a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java
@@ -58,7 +58,7 @@ import android.os.test.TestLooper;
import androidx.test.filters.SmallTest;
-import com.android.server.wifi.WifiNative.SendMgmtFrameCallback;
+import com.android.server.wifi.WificondControl.SendMgmtFrameCallback;
import com.android.server.wifi.util.NativeUtil;
import com.android.server.wifi.wificond.ChannelSettings;
import com.android.server.wifi.wificond.HiddenNetwork;
@@ -1018,7 +1018,7 @@ public class WificondControlTest extends WifiBaseTest {
any(), eq(TEST_MCS_RATE));
mWificondControl.sendMgmtFrame(TEST_INTERFACE_NAME, TEST_PROBE_FRAME, cb2, TEST_MCS_RATE);
- verify(cb2).onFailure(WifiNative.SEND_MGMT_FRAME_ERROR_ALREADY_STARTED);
+ verify(cb2).onFailure(WificondControl.SEND_MGMT_FRAME_ERROR_ALREADY_STARTED);
// verify SendMgmtFrame() still was only called once i.e. not called again
verify(mClientInterface, times(1))
.SendMgmtFrame(any(), any(), anyInt());
@@ -1050,7 +1050,8 @@ public class WificondControlTest extends WifiBaseTest {
verify(cb).onFailure(anyInt());
verify(mAlarmManager).cancel(eq(alarmListenerCaptor.getValue()));
- sendMgmtFrameEventCaptor.getValue().OnFailure(WifiNative.SEND_MGMT_FRAME_ERROR_UNKNOWN);
+ sendMgmtFrameEventCaptor.getValue().OnFailure(
+ WificondControl.SEND_MGMT_FRAME_ERROR_UNKNOWN);
mLooper.dispatchAll();
handlerCaptor.getValue().post(() -> alarmListenerCaptor.getValue().onAlarm());
@@ -1109,10 +1110,11 @@ public class WificondControlTest extends WifiBaseTest {
alarmListenerCaptor.capture(), handlerCaptor.capture());
mWificondControl.sendMgmtFrame(TEST_INTERFACE_NAME, TEST_PROBE_FRAME, cb, TEST_MCS_RATE);
- sendMgmtFrameEventCaptor.getValue().OnFailure(WifiNative.SEND_MGMT_FRAME_ERROR_UNKNOWN);
+ sendMgmtFrameEventCaptor.getValue().OnFailure(
+ WificondControl.SEND_MGMT_FRAME_ERROR_UNKNOWN);
mLooper.dispatchAll();
verify(cb, never()).onAck(anyInt());
- verify(cb).onFailure(eq(WifiNative.SEND_MGMT_FRAME_ERROR_UNKNOWN));
+ verify(cb).onFailure(WificondControl.SEND_MGMT_FRAME_ERROR_UNKNOWN);
verify(mAlarmManager).cancel(eq(alarmListenerCaptor.getValue()));
// verify that even if timeout is triggered afterwards, SendMgmtFrameCallback is not
@@ -1144,7 +1146,7 @@ public class WificondControlTest extends WifiBaseTest {
handlerCaptor.getValue().post(() -> alarmListenerCaptor.getValue().onAlarm());
mLooper.dispatchAll();
verify(cb, never()).onAck(anyInt());
- verify(cb).onFailure(eq(WifiNative.SEND_MGMT_FRAME_ERROR_TIMEOUT));
+ verify(cb).onFailure(WificondControl.SEND_MGMT_FRAME_ERROR_TIMEOUT);
// verify that even if onAck() callback is triggered after timeout,
// SendMgmtFrameCallback is not triggered again
@@ -1215,7 +1217,7 @@ public class WificondControlTest extends WifiBaseTest {
sendMgmtFrameEventCaptor.getValue().OnAck(TEST_SEND_MGMT_FRAME_ELAPSED_TIME_MS);
mLooper.dispatchAll();
verify(mSendMgmtFrameCallback, never()).onAck(anyInt());
- verify(mSendMgmtFrameCallback).onFailure(eq(WifiNative.SEND_MGMT_FRAME_ERROR_TIMEOUT));
+ verify(mSendMgmtFrameCallback).onFailure(WificondControl.SEND_MGMT_FRAME_ERROR_TIMEOUT);
}
/**
@@ -1240,9 +1242,10 @@ public class WificondControlTest extends WifiBaseTest {
// triggering onAlarm() ourselves during the test, manually post onto handler
handlerCaptor.getValue().post(() -> alarmListenerCaptor.getValue().onAlarm());
// OnFailure posts to the handler
- sendMgmtFrameEventCaptor.getValue().OnFailure(WifiNative.SEND_MGMT_FRAME_ERROR_UNKNOWN);
+ sendMgmtFrameEventCaptor.getValue().OnFailure(
+ WificondControl.SEND_MGMT_FRAME_ERROR_UNKNOWN);
mLooper.dispatchAll();
- verify(mSendMgmtFrameCallback).onFailure(eq(WifiNative.SEND_MGMT_FRAME_ERROR_TIMEOUT));
+ verify(mSendMgmtFrameCallback).onFailure(WificondControl.SEND_MGMT_FRAME_ERROR_TIMEOUT);
}
private void assertRadioChainInfosEqual(