From 2a0ad34fff0956b85afa702617a3322ca85c3dca Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Tue, 16 May 2017 13:31:35 -0700 Subject: WifiMetrics: Add methods to increment new hal/cond metrics Bug: 36586897 Test: Unit tests Change-Id: Ic3bca30e59111923f6c7b65e8955b4d37046b2e0 (cherry picked from commit bd2cff58fca2f3d9a0cd6df8526b23f48d9d44ec) --- .../com/android/server/wifi/WifiMetricsTest.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java index 4d9c906ea..1c09cac38 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java @@ -231,6 +231,10 @@ public class WifiMetricsTest { 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 static final int NUM_HAL_CRASHES = 11; + private static final int NUM_WIFICOND_CRASHES = 12; + private static final int NUM_WIFI_ON_FAILURE_DUE_TO_HAL = 13; + private static final int NUM_WIFI_ON_FAILURE_DUE_TO_WIFICOND = 14; private ScanDetail buildMockScanDetail(boolean hidden, NetworkDetail.HSRelease hSRelease, String capabilities) { @@ -403,6 +407,18 @@ public class WifiMetricsTest { mWifiMetrics.incrementSoftApStartResult(false, WifiManager.SAP_START_FAILURE_NO_CHANNEL); } + for (int i = 0; i < NUM_HAL_CRASHES; i++) { + mWifiMetrics.incrementNumHalCrashes(); + } + for (int i = 0; i < NUM_WIFICOND_CRASHES; i++) { + mWifiMetrics.incrementNumWificondCrashes(); + } + for (int i = 0; i < NUM_WIFI_ON_FAILURE_DUE_TO_HAL; i++) { + mWifiMetrics.incrementNumWifiOnFailureDueToHal(); + } + for (int i = 0; i < NUM_WIFI_ON_FAILURE_DUE_TO_WIFICOND; i++) { + mWifiMetrics.incrementNumWifiOnFailureDueToWificond(); + } } /** @@ -539,6 +555,12 @@ public class WifiMetricsTest { mDeserializedWifiMetrics.softApReturnCode[2].startResult); assertEquals(NUM_SOFTAP_FAILED_NO_CHANNEL, mDeserializedWifiMetrics.softApReturnCode[2].count); + assertEquals(NUM_HAL_CRASHES, mDeserializedWifiMetrics.numHalCrashes); + assertEquals(NUM_WIFICOND_CRASHES, mDeserializedWifiMetrics.numWificondCrashes); + assertEquals(NUM_WIFI_ON_FAILURE_DUE_TO_HAL, + mDeserializedWifiMetrics.numWifiOnFailureDueToHal); + assertEquals(NUM_WIFI_ON_FAILURE_DUE_TO_WIFICOND, + mDeserializedWifiMetrics.numWifiOnFailureDueToWificond); } /** -- cgit v1.2.3