summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/DppManagerTest.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/DppMetricsTest.java126
2 files changed, 132 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/DppManagerTest.java b/tests/wifitests/src/com/android/server/wifi/DppManagerTest.java
index 19d17c979..e274d680f 100644
--- a/tests/wifitests/src/com/android/server/wifi/DppManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/DppManagerTest.java
@@ -481,6 +481,7 @@ public class DppManagerTest extends WifiBaseTest {
dppEventCallback.onSuccess(CONFIGURATION_SENT);
mLooper.dispatchAll();
verify(mDppCallback).onSuccess(eq(EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT));
+ verify(mDppMetrics, times(1)).updateDppR1CapableEnrolleeResponderDevices();
verify(mDppCallback, never()).onSuccessConfigReceived(anyInt());
verify(mDppCallback, never()).onFailure(anyInt(), anyString(), anyString(), any());
verify(mDppMetrics).updateDppConfiguratorInitiatorRequests();
@@ -861,6 +862,7 @@ public class DppManagerTest extends WifiBaseTest {
mLooper.dispatchAll();
verify(mDppCallback)
.onProgress(eq(EASY_CONNECT_EVENT_PROGRESS_CONFIGURATION_SENT_WAITING_RESPONSE));
+ verify(mDppMetrics, times(1)).updateDppR2CapableEnrolleeResponderDevices();
// Generate an onSuccess callback
dppEventCallback.onSuccess(CONFIGURATION_APPLIED);
@@ -912,6 +914,10 @@ public class DppManagerTest extends WifiBaseTest {
verify(mDppMetrics).updateDppConfiguratorInitiatorRequests();
verify(mDppMetrics).updateDppFailure(eq(appFailure));
verify(mDppMetrics).updateDppOperationTime(anyInt());
+ if ((internalFailure == CANNOT_FIND_NETWORK)
+ && (appFailure == EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE)) {
+ verify(mDppMetrics, times(1)).updateDppR2EnrolleeResponderIncompatibleConfiguration();
+ }
verifyNoMoreInteractions(mDppMetrics);
verifyCleanUpResources();
}
diff --git a/tests/wifitests/src/com/android/server/wifi/DppMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/DppMetricsTest.java
index fd43578b1..e43da8f06 100644
--- a/tests/wifitests/src/com/android/server/wifi/DppMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/DppMetricsTest.java
@@ -18,13 +18,17 @@ package com.android.server.wifi;
import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_AUTHENTICATION;
import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_BUSY;
+import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK;
import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_CONFIGURATION;
+import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION;
+import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION;
import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_GENERIC;
import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK;
import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_INVALID_URI;
import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE;
import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED;
import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_FAILURE_TIMEOUT;
+import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_APPLIED;
import static android.net.wifi.EasyConnectStatusCallback.EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT;
import static com.android.server.wifi.DppMetrics.DPP_OPERATION_TIME;
@@ -185,10 +189,16 @@ public class DppMetricsTest extends WifiBaseTest {
for (int i = 0; i < value; i++) {
mDppMetrics.updateDppConfiguratorSuccess(EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT);
}
+ for (int i = 0; i < value; i++) {
+ mDppMetrics.updateDppConfiguratorSuccess(
+ EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_APPLIED);
+ }
// Confirm that the consolidated log has the expected value
checkDppSuccesses(WifiMetricsProto.WifiDppLog.EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_SENT,
value);
+ checkDppSuccesses(WifiMetricsProto.WifiDppLog
+ .EASY_CONNECT_EVENT_SUCCESS_CONFIGURATION_APPLIED, value);
}
/**
@@ -378,6 +388,65 @@ public class DppMetricsTest extends WifiBaseTest {
}
/**
+ * Test EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testUpdateDppFailureCannotFindNetwork() throws Exception {
+ // Get a random value and call the update method 'value' times
+ int value = getNumOfTimes(MAX_ITERATIONS) + 1;
+
+ for (int i = 0; i < value; i++) {
+ mDppMetrics.updateDppFailure(EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK);
+ }
+
+ // Confirm that the consolidated log has the expected value
+ checkDppFailures(WifiMetricsProto.WifiDppLog.EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK,
+ value);
+ }
+
+ /**
+ * Test EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testUpdateDppFailureEnrolleeAuthentication() throws Exception {
+ // Get a random value and call the update method 'value' times
+ int value = getNumOfTimes(MAX_ITERATIONS) + 1;
+
+ for (int i = 0; i < value; i++) {
+ mDppMetrics.updateDppFailure(EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION);
+ }
+
+ // Confirm that the consolidated log has the expected value
+ checkDppFailures(WifiMetricsProto.WifiDppLog
+ .EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION, value);
+ }
+
+ /**
+ * Test
+ * EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testUpdateDppFailureEnrolleeRejectedConfiguration() throws Exception {
+ // Get a random value and call the update method 'value' times
+ int value = getNumOfTimes(MAX_ITERATIONS) + 1;
+
+ for (int i = 0; i < value; i++) {
+ mDppMetrics.updateDppFailure(
+ EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION);
+ }
+
+ // Confirm that the consolidated log has the expected value
+ checkDppFailures(WifiMetricsProto.WifiDppLog
+ .EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION, value);
+ }
+
+ /**
* Test DPP operation time histogram. Pick a single time value from each bucket by selecting
* the max value minus 1, and call the update method random amount of times with this value.
* Then confirm that the output histogram has the expected value in each target bucket.
@@ -410,4 +479,61 @@ public class DppMetricsTest extends WifiBaseTest {
checkOperationBucketEqualsTo(i, value);
}
}
+
+ /**
+ * Test numDppR1CapableEnrolleeResponderDevices
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testUpdateDppR1CapableEnrolleeResponderDevices() throws Exception {
+ // Get a random value and call the update method 'value' times
+ int value = getNumOfTimes(MAX_ITERATIONS) + 1;
+
+ for (int i = 0; i < value; i++) {
+ mDppMetrics.updateDppR1CapableEnrolleeResponderDevices();
+ }
+
+ // Confirm that the consolidated log has the expected value
+ WifiMetricsProto.WifiDppLog mWifiDppLogProto = mDppMetrics.consolidateProto();
+ assertEquals(mWifiDppLogProto.numDppR1CapableEnrolleeResponderDevices, value);
+ }
+
+ /**
+ * Test numDppR2CapableEnrolleeResponderDevices
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testUpdateDppR2CapableEnrolleeResponderDevices() throws Exception {
+ // Get a random value and call the update method 'value' times
+ int value = getNumOfTimes(MAX_ITERATIONS) + 1;
+
+ for (int i = 0; i < value; i++) {
+ mDppMetrics.updateDppR2CapableEnrolleeResponderDevices();
+ }
+
+ // Confirm that the consolidated log has the expected value
+ WifiMetricsProto.WifiDppLog mWifiDppLogProto = mDppMetrics.consolidateProto();
+ assertEquals(mWifiDppLogProto.numDppR2CapableEnrolleeResponderDevices, value);
+ }
+
+ /**
+ * Test numDppR2EnrolleeResponderIncompatibleConfiguration
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testUpdateDppR2EnrolleeResponderIncompatibleConfiguration() throws Exception {
+ // Get a random value and call the update method 'value' times
+ int value = getNumOfTimes(MAX_ITERATIONS) + 1;
+
+ for (int i = 0; i < value; i++) {
+ mDppMetrics.updateDppR2EnrolleeResponderIncompatibleConfiguration();
+ }
+
+ // Confirm that the consolidated log has the expected value
+ WifiMetricsProto.WifiDppLog mWifiDppLogProto = mDppMetrics.consolidateProto();
+ assertEquals(mWifiDppLogProto.numDppR2EnrolleeResponderIncompatibleConfiguration, value);
+ }
}