summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNate Jiang <qiangjiang@google.com>2020-05-21 16:06:06 -0700
committerNate Jiang <qiangjiang@google.com>2020-05-26 12:28:38 -0700
commit07ac7b74013417eba3ac212997f979d5272e658c (patch)
tree57307f844e883f8f814209089bb9c0eaaa419d8b /tests
parentc57a88d72e9d0f87d1bf4135ddb2bb02df67762c (diff)
[Metrics] Add metric for BSSID different between framework and FW
Updated-PDD: TRUE Bug: 131613031 Test: atest com.android.server.wifi Change-Id: Ied3c92ad18b6503c901ad1240d00221e978fa717
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java17
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java6
2 files changed, 22 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 8195117e7..db8bd677d 100644
--- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
@@ -2944,6 +2944,8 @@ public class ClientModeImplTest extends WifiBaseTest {
*/
@Test
public void testReportConnectionEventIsCalledAfterAssociationFailure() throws Exception {
+ mConnectedNetwork.getNetworkSelectionStatus()
+ .setCandidate(getGoogleGuestScanDetail(TEST_RSSI, sBSSID, sFreq).getScanResult());
// Setup CONNECT_MODE & a WifiConfiguration
initializeAndAddNetworkAndVerifySuccess();
mCmi.sendMessage(ClientModeImpl.CMD_START_CONNECT, 0, 0, sBSSID);
@@ -2962,6 +2964,8 @@ public class ClientModeImplTest extends WifiBaseTest {
verify(mWifiNetworkSuggestionsManager).handleConnectionAttemptEnded(
eq(WifiMetrics.ConnectionEvent.FAILURE_ASSOCIATION_REJECTION),
any(WifiConfiguration.class), eq(null));
+ verify(mWifiMetrics, never())
+ .incrementNumBssidDifferentSelectionBetweenFrameworkAndFirmware();
verifyConnectionEventTimeoutDoesNotOccur();
}
@@ -2973,6 +2977,8 @@ public class ClientModeImplTest extends WifiBaseTest {
*/
@Test
public void testReportConnectionEventIsCalledAfterAuthenticationFailure() throws Exception {
+ mConnectedNetwork.getNetworkSelectionStatus()
+ .setCandidate(getGoogleGuestScanDetail(TEST_RSSI, sBSSID, sFreq).getScanResult());
// Setup CONNECT_MODE & a WifiConfiguration
initializeAndAddNetworkAndVerifySuccess();
mCmi.sendMessage(ClientModeImpl.CMD_START_CONNECT, 0, 0, sBSSID);
@@ -2991,6 +2997,8 @@ public class ClientModeImplTest extends WifiBaseTest {
verify(mWifiNetworkSuggestionsManager).handleConnectionAttemptEnded(
eq(WifiMetrics.ConnectionEvent.FAILURE_AUTHENTICATION_FAILURE),
any(WifiConfiguration.class), eq(null));
+ verify(mWifiMetrics, never())
+ .incrementNumBssidDifferentSelectionBetweenFrameworkAndFirmware();
verifyConnectionEventTimeoutDoesNotOccur();
}
@@ -3165,6 +3173,8 @@ public class ClientModeImplTest extends WifiBaseTest {
*/
@Test
public void testReportConnectionEventIsCalledAfterDhcpFailure() throws Exception {
+ mConnectedNetwork.getNetworkSelectionStatus()
+ .setCandidate(getGoogleGuestScanDetail(TEST_RSSI, sBSSID, sFreq).getScanResult());
testDhcpFailure();
verify(mWifiDiagnostics, atLeastOnce()).reportConnectionEvent(
eq(WifiDiagnostics.CONNECTION_EVENT_FAILED));
@@ -3175,6 +3185,8 @@ public class ClientModeImplTest extends WifiBaseTest {
verify(mWifiNetworkSuggestionsManager, atLeastOnce()).handleConnectionAttemptEnded(
eq(WifiMetrics.ConnectionEvent.FAILURE_DHCP), any(WifiConfiguration.class),
any(String.class));
+ verify(mWifiMetrics, never())
+ .incrementNumBssidDifferentSelectionBetweenFrameworkAndFirmware();
verifyConnectionEventTimeoutDoesNotOccur();
}
@@ -3186,8 +3198,9 @@ public class ClientModeImplTest extends WifiBaseTest {
*/
@Test
public void testReportConnectionEventIsCalledAfterSuccessfulConnection() throws Exception {
+ mConnectedNetwork.getNetworkSelectionStatus()
+ .setCandidate(getGoogleGuestScanDetail(TEST_RSSI, sBSSID1, sFreq).getScanResult());
connect();
-
ArgumentCaptor<Messenger> messengerCaptor = ArgumentCaptor.forClass(Messenger.class);
verify(mConnectivityManager).registerNetworkAgent(messengerCaptor.capture(),
any(NetworkInfo.class), any(LinkProperties.class), any(NetworkCapabilities.class),
@@ -3209,6 +3222,8 @@ public class ClientModeImplTest extends WifiBaseTest {
verify(mWifiNetworkSuggestionsManager).handleConnectionAttemptEnded(
eq(WifiMetrics.ConnectionEvent.FAILURE_NONE), any(WifiConfiguration.class),
any(String.class));
+ // BSSID different, record this connection.
+ verify(mWifiMetrics).incrementNumBssidDifferentSelectionBetweenFrameworkAndFirmware();
verifyConnectionEventTimeoutDoesNotOccur();
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 04730bbe3..7bb811f1a 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -440,6 +440,7 @@ public class WifiMetricsTest extends WifiBaseTest {
private static final int NUM_NETWORK_ABNORMAL_ASSOC_REJECTION = 2;
private static final int NUM_NETWORK_SUFFICIENT_RECENT_STATS_ONLY = 4;
private static final int NUM_NETWORK_SUFFICIENT_RECENT_PREV_STATS = 5;
+ private static final int NUM_BSSID_SELECTION_DIFFERENT_BETWEEN_FRAMEWORK_FIRMWARE = 3;
/** Number of notifications per "Connect to Network" notification type. */
private static final int[] NUM_CONNECT_TO_NETWORK_NOTIFICATIONS = {0, 10, 20, 30, 40};
@@ -909,6 +910,9 @@ public class WifiMetricsTest extends WifiBaseTest {
for (int i = 0; i < NUM_PNO_FOUND_NETWORK_EVENTS; i++) {
mWifiMetrics.incrementPnoFoundNetworkEventCount();
}
+ for (int i = 0; i < NUM_BSSID_SELECTION_DIFFERENT_BETWEEN_FRAMEWORK_FIRMWARE; i++) {
+ mWifiMetrics.incrementNumBssidDifferentSelectionBetweenFrameworkAndFirmware();
+ }
// set and increment "connect to network" notification metrics
for (int i = 0; i < NUM_CONNECT_TO_NETWORK_NOTIFICATIONS.length; i++) {
@@ -1324,6 +1328,8 @@ public class WifiMetricsTest extends WifiBaseTest {
mDecodedProto.numPasspointProviderWithSelfSignedRootCa);
assertEquals(NUM_PASSPOINT_PROVIDERS_WITH_EXPIRATION_DATE,
mDecodedProto.numPasspointProviderWithSubscriptionExpiration);
+ assertEquals(NUM_BSSID_SELECTION_DIFFERENT_BETWEEN_FRAMEWORK_FIRMWARE,
+ mDecodedProto.numBssidDifferentSelectionBetweenFrameworkAndFirmware);
assertEquals(NUM_RADIO_MODE_CHANGE_TO_MCC, mDecodedProto.numRadioModeChangeToMcc);
assertEquals(NUM_RADIO_MODE_CHANGE_TO_SCC, mDecodedProto.numRadioModeChangeToScc);