summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSteven Liu <steveliu@google.com>2020-04-30 19:58:43 -0700
committerSteven Liu <steveliu@google.com>2020-05-29 16:34:42 -0700
commitb5a8f62f9ff6667bbce349569659a84fbd826db0 (patch)
tree69966578d4a60c5e0260e68c101e5a7ae8b1f6fa /tests
parente1273d71ef5e5b4615e02aabad0b770c90b4ba15 (diff)
Add CarrierWifi metrics
Updated-PDD: TRUE Bug: 145762500 Test: atest com.android.server.wifi Merged-In: I11a60c877cd0a7594a4a691207e89935f35fe22e Change-Id: Ifd03a0e6d15d777e632f000c07a666d1d5491d6c
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java9
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java17
2 files changed, 25 insertions, 1 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
index c3829be46..bb9db6d51 100644
--- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
@@ -997,6 +997,8 @@ public class ClientModeImplTest extends WifiBaseTest {
@Test
public void connect() throws Exception {
triggerConnect();
+ WifiConfiguration config = mWifiConfigManager.getConfiguredNetwork(FRAMEWORK_NETWORK_ID);
+ config.carrierId = CARRIER_ID_1;
when(mWifiConfigManager.getScanDetailCacheForNetwork(FRAMEWORK_NETWORK_ID))
.thenReturn(mScanDetailCache);
@@ -1045,6 +1047,7 @@ public class ClientModeImplTest extends WifiBaseTest {
assertEquals("", mConnectedNetwork.enterpriseConfig.getAnonymousIdentity());
verify(mWifiStateTracker).updateState(eq(WifiStateTracker.CONNECTED));
assertEquals("ConnectedState", getCurrentState().getName());
+ verify(mWifiMetrics).incrementNumOfCarrierWifiConnectionSuccess();
verify(mWifiLockManager).updateWifiClientConnected(true);
verify(mWifiNative).getConnectionCapabilities(any());
verify(mThroughputPredictor).predictMaxTxThroughput(any());
@@ -1703,6 +1706,7 @@ public class ClientModeImplTest extends WifiBaseTest {
WifiConfiguration config = new WifiConfiguration();
config.SSID = sSSID;
config.getNetworkSelectionStatus().setHasEverConnected(false);
+ config.carrierId = CARRIER_ID_1;
when(mWifiConfigManager.getConfiguredNetwork(anyInt())).thenReturn(config);
mCmi.sendMessage(WifiMonitor.AUTHENTICATION_FAILURE_EVENT,
@@ -1712,7 +1716,7 @@ public class ClientModeImplTest extends WifiBaseTest {
verify(mWrongPasswordNotifier).onWrongPasswordError(eq(sSSID));
verify(mWifiConfigManager).updateNetworkSelectionStatus(anyInt(),
eq(WifiConfiguration.NetworkSelectionStatus.DISABLED_BY_WRONG_PASSWORD));
-
+ verify(mWifiMetrics).incrementNumOfCarrierWifiConnectionAuthFailure();
assertEquals("DisconnectedState", getCurrentState().getName());
}
@@ -3077,6 +3081,8 @@ public class ClientModeImplTest extends WifiBaseTest {
@Test
public void testAssociationRejectionUpdatesWatchdog() throws Exception {
initializeAndAddNetworkAndVerifySuccess();
+ WifiConfiguration config = mWifiConfigManager.getConfiguredNetwork(FRAMEWORK_NETWORK_ID);
+ config.carrierId = CARRIER_ID_1;
mCmi.sendMessage(ClientModeImpl.CMD_START_CONNECT, 0, 0, sBSSID);
mCmi.sendMessage(WifiMonitor.ASSOCIATION_REJECTION_EVENT, 0, 0, sBSSID);
mLooper.dispatchAll();
@@ -3084,6 +3090,7 @@ public class ClientModeImplTest extends WifiBaseTest {
anyString(), anyString(), anyInt());
verify(mBssidBlocklistMonitor).handleBssidConnectionFailure(sBSSID, sSSID,
BssidBlocklistMonitor.REASON_ASSOCIATION_REJECTION, false);
+ verify(mWifiMetrics).incrementNumOfCarrierWifiConnectionNonAuthFailure();
}
/**
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 67d0c82a7..fcaee0550 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -4975,4 +4975,21 @@ public class WifiMetricsTest extends WifiBaseTest {
assertEquals(0, mWifiMetrics.startConnectionEvent(mTestWifiConfig, "TestNetwork",
WifiMetricsProto.ConnectionEvent.ROAM_ENTERPRISE));
}
+
+ @Test
+ public void testCarrierWifiConnectionEvent() throws Exception {
+ mWifiMetrics.incrementNumOfCarrierWifiConnectionSuccess();
+ for (int i = 0; i < 2; i++) {
+ mWifiMetrics.incrementNumOfCarrierWifiConnectionAuthFailure();
+ }
+ for (int i = 0; i < 3; i++) {
+ mWifiMetrics.incrementNumOfCarrierWifiConnectionNonAuthFailure();
+ }
+
+ dumpProtoAndDeserialize();
+
+ assertEquals(1, mDecodedProto.carrierWifiMetrics.numConnectionSuccess);
+ assertEquals(2, mDecodedProto.carrierWifiMetrics.numConnectionAuthFailure);
+ assertEquals(3, mDecodedProto.carrierWifiMetrics.numConnectionNonAuthFailure);
+ }
}