summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRebecca Silberstein <silberst@google.com>2017-01-25 11:08:13 -0800
committerRebecca Silberstein <silberst@google.com>2017-02-24 17:11:19 +0000
commit44ce135519e22d8c4746abac21c14111f1ce8667 (patch)
tree31a3bd5ded6244c46c20dfd8edb787597def97e1 /tests
parent80a1468c75b0db36e58de767c74f7c15e9aa55e3 (diff)
WifiMetrics: use SoftAp return code metrics
Add calls to populate SoftAp startup return code values to metrics. This CL also adds the handling of these metrics in WifiMetrics. The newly tracked SoftAp start return code metric is also added to the WifiMetricsTest. Bug: 30899122 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Test: frameworks/base/wifi/tests/runtests.sh Test: manually verified code counts incrementing with dumpsys wifi Change-Id: I9256e08c0de6e9d4132e5aab3d604ba0ef6922c0
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 7bb0b8932..49056f97e 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -22,6 +22,7 @@ import static org.mockito.Mockito.*;
import android.net.NetworkAgent;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiManager;
import android.test.suitebuilder.annotation.SmallTest;
import android.util.Base64;
@@ -214,6 +215,10 @@ public class WifiMetricsTest {
private static final int NUM_WIFI_SCORES_TO_INCREMENT = 20;
private static final int WIFI_SCORE_RANGE_MAX = 60;
private static final int NUM_OUT_OF_BOUND_ENTRIES = 10;
+ private static final int MAX_NUM_SOFTAP_RETURN_CODES = 3;
+ private static final int NUM_SOFTAP_START_SUCCESS = 3;
+ private static final int NUM_SOFTAP_FAILED_GENERAL_ERROR = 2;
+ private static final int NUM_SOFTAP_FAILED_NO_CHANNEL = 1;
private ScanDetail buildMockScanDetail(boolean hidden, NetworkDetail.HSRelease hSRelease,
String capabilities) {
@@ -374,6 +379,18 @@ public class WifiMetricsTest {
for (int i = 1; i < NUM_OUT_OF_BOUND_ENTRIES; i++) {
mWifiMetrics.incrementWifiScoreCount(WIFI_SCORE_RANGE_MAX + i);
}
+
+ // increment soft ap start return codes
+ for (int i = 0; i < NUM_SOFTAP_START_SUCCESS; i++) {
+ mWifiMetrics.incrementSoftApStartResult(true, 0);
+ }
+ for (int i = 0; i < NUM_SOFTAP_FAILED_GENERAL_ERROR; i++) {
+ mWifiMetrics.incrementSoftApStartResult(false, WifiManager.SAP_START_FAILURE_GENERAL);
+ }
+ for (int i = 0; i < NUM_SOFTAP_FAILED_NO_CHANNEL; i++) {
+ mWifiMetrics.incrementSoftApStartResult(false,
+ WifiManager.SAP_START_FAILURE_NO_CHANNEL);
+ }
}
/**
@@ -498,6 +515,18 @@ public class WifiMetricsTest {
sb_wifi_limits.append("Wifi Score limit is " + NetworkAgent.WIFI_BASE_SCORE
+ ">= " + WIFI_SCORE_RANGE_MAX);
assertTrue(sb_wifi_limits.toString(), NetworkAgent.WIFI_BASE_SCORE <= WIFI_SCORE_RANGE_MAX);
+ assertEquals(MAX_NUM_SOFTAP_RETURN_CODES, mDeserializedWifiMetrics.softApReturnCode.length);
+ assertEquals(WifiMetricsProto.SoftApReturnCodeCount.SOFT_AP_STARTED_SUCCESSFULLY,
+ mDeserializedWifiMetrics.softApReturnCode[0].startResult);
+ assertEquals(NUM_SOFTAP_START_SUCCESS, mDeserializedWifiMetrics.softApReturnCode[0].count);
+ assertEquals(WifiMetricsProto.SoftApReturnCodeCount.SOFT_AP_FAILED_GENERAL_ERROR,
+ mDeserializedWifiMetrics.softApReturnCode[1].startResult);
+ assertEquals(NUM_SOFTAP_FAILED_GENERAL_ERROR,
+ mDeserializedWifiMetrics.softApReturnCode[1].count);
+ assertEquals(WifiMetricsProto.SoftApReturnCodeCount.SOFT_AP_FAILED_NO_CHANNEL,
+ mDeserializedWifiMetrics.softApReturnCode[2].startResult);
+ assertEquals(NUM_SOFTAP_FAILED_NO_CHANNEL,
+ mDeserializedWifiMetrics.softApReturnCode[2].count);
}
/**