diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java | 17 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java | 6 |
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 1761b2113..c3829be46 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 e4e58c1df..67d0c82a7 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); |