summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-05-30 00:51:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-05-30 00:51:06 +0000
commit4c324bef94bacc4d6f2f761dd286c43f72b5f773 (patch)
tree78fbf4cc8f58caac0f91b96a18982a55313bb04a /tests
parent47d386420fb3e3523f643f0d1e1fd3496c5f6aeb (diff)
parentb5a8f62f9ff6667bbce349569659a84fbd826db0 (diff)
Merge "Add CarrierWifi metrics" into rvc-dev
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);
+ }
}