diff options
author | xshu <xshu@google.com> | 2018-04-18 15:44:06 -0700 |
---|---|---|
committer | xshu <xshu@google.com> | 2018-04-23 15:04:46 -0700 |
commit | d9d2a093b6f1613f08c72798f0dee7abdedc8213 (patch) | |
tree | 93a86e2c01cbe62c01a3ebbbf0579f424d1b5193 /tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java | |
parent | ac16e622382ff0b82b0b47c102938d5103ddb53a (diff) | |
download | android_frameworks_opt_net_wifi-d9d2a093b6f1613f08c72798f0dee7abdedc8213.tar.gz android_frameworks_opt_net_wifi-d9d2a093b6f1613f08c72798f0dee7abdedc8213.tar.bz2 android_frameworks_opt_net_wifi-d9d2a093b6f1613f08c72798f0dee7abdedc8213.zip |
LRWD: Remove obsolete snapshot grabbing check
No longer need this because we are enforcing something even more strict.
Bug: 77655949
Test: compile, unit test
Change-Id: Ic48999b4b0dcb633085afb66bcc63400c143b4c8
Diffstat (limited to 'tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java | 118 |
1 files changed, 12 insertions, 106 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java b/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java index 0647892ab..3809c7f74 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java @@ -901,7 +901,7 @@ public class WifiLastResortWatchdogTest { int dhcpFailures = 11; // Set Watchdogs internal wifi state tracking to 'connected' - mLastResortWatchdog.connectedStateTransition(true, ""); + mLastResortWatchdog.connectedStateTransition(true); // Buffer potential candidates 1,2,3 & 4 List<Pair<ScanDetail, WifiConfiguration>> candidates = createFilteredQnsCandidates(mSsids, @@ -980,7 +980,7 @@ public class WifiLastResortWatchdogTest { assertFailureCountEquals(mBssids[2], 0, 0, dhcpFailures); // Transition to 'ConnectedState' - mLastResortWatchdog.connectedStateTransition(true, ""); + mLastResortWatchdog.connectedStateTransition(true); // Check that we have no failures for (int i = 0; i < mSsids.length; i++) { @@ -1234,7 +1234,7 @@ public class WifiLastResortWatchdogTest { mLastResortWatchdog.updateAvailableNetworks(candidates); // Set Watchdogs internal wifi state tracking to 'connected' - mLastResortWatchdog.connectedStateTransition(true, ""); + mLastResortWatchdog.connectedStateTransition(true); // Count failures on all 4 networks until all of them are over the failure threshold boolean watchdogTriggered = false; @@ -1349,8 +1349,8 @@ public class WifiLastResortWatchdogTest { } // transition Watchdog wifi state tracking to 'connected' then back to 'disconnected' - mLastResortWatchdog.connectedStateTransition(true, ""); - mLastResortWatchdog.connectedStateTransition(false, ""); + mLastResortWatchdog.connectedStateTransition(true); + mLastResortWatchdog.connectedStateTransition(false); // Fail 3/4 networks until they're over threshold for (int i = 0; i < WifiLastResortWatchdog.FAILURE_THRESHOLD + 1; i++) { @@ -1492,7 +1492,7 @@ public class WifiLastResortWatchdogTest { verify(mWifiMetrics, times(1)).incrementNumLastResortWatchdogTriggersWithBadDhcp(); // Simulate wifi connecting after triggering - mLastResortWatchdog.connectedStateTransition(true, "\"test1\""); + mLastResortWatchdog.connectedStateTransition(true); // Verify that WifiMetrics counted this as a Watchdog success verify(mWifiMetrics, times(1)).incrementNumLastResortWatchdogSuccesses(); @@ -1503,7 +1503,7 @@ public class WifiLastResortWatchdogTest { verify(mWifiStateMachine, times(1)).takeBugReport(anyString(), anyString()); // Simulate wifi disconnecting - mLastResortWatchdog.connectedStateTransition(false, "\"test1\""); + mLastResortWatchdog.connectedStateTransition(false); // Verify that WifiMetrics has still only counted one success verify(mWifiMetrics, times(1)).incrementNumLastResortWatchdogSuccesses(); @@ -1546,7 +1546,7 @@ public class WifiLastResortWatchdogTest { mLastResortWatchdog.updateAvailableNetworks(candidates); // Simulate wifi connecting - mLastResortWatchdog.connectedStateTransition(true, ""); + mLastResortWatchdog.connectedStateTransition(true); // Verify that WifiMetrics did not count another success, as the connection could be due // to the newly available network #5 @@ -1729,100 +1729,6 @@ public class WifiLastResortWatchdogTest { } /** - * Case 29: Test connection success after wifi restart with an unexpected SSID - * Setup 1 network. Fail the network until watchcdog triggers. Trigger a connection success on - * a network which has a different SSID than the network that has been failing. - * Expected behavior: bugreport is not triggered - */ - @Test - public void testConnectionSuccessWithUnexpectedSsidDoesNotTriggerBugreport() { - String[] ssids = {"\"test1\""}; - String[] bssids = {"6c:f3:7f:ae:8c:f3"}; - int[] frequencies = {2437}; - String[] caps = {"[WPA2-EAP-CCMP][ESS]"}; - int[] levels = {-60}; - boolean[] isEphemeral = {false}; - boolean[] hasEverConnected = {true}; - List<Pair<ScanDetail, WifiConfiguration>> candidates = createFilteredQnsCandidates(ssids, - bssids, frequencies, caps, levels, isEphemeral, hasEverConnected); - mLastResortWatchdog.updateAvailableNetworks(candidates); - - // Ensure new networks have zero'ed failure counts - for (int i = 0; i < ssids.length; i++) { - assertFailureCountEquals(bssids[i], 0, 0, 0); - } - - //Increment failure counts - for (int i = 0; i < WifiLastResortWatchdog.FAILURE_THRESHOLD; i++) { - mLastResortWatchdog.noteConnectionFailureAndTriggerIfNeeded( - ssids[0], bssids[0], WifiLastResortWatchdog.FAILURE_CODE_ASSOCIATION); - } - - // Verify relevant WifiMetrics calls were made once with appropriate arguments - verify(mWifiMetrics, times(1)).incrementNumLastResortWatchdogTriggers(); - - // Simulate wifi connecting after triggering on a unexpected SSID - mLastResortWatchdog.connectedStateTransition(true, "blahssss"); - // Verify takeBugReport is not called - mLooper.dispatchAll(); - verify(mWifiStateMachine, times(0)).takeBugReport(anyString(), anyString()); - - // Simulate wifi connecting after triggering is the expected SSID, which should be ignored - // because watchdog state should already be reset to detect for failures - mLastResortWatchdog.connectedStateTransition(true, "\"test1\""); - // Verify takeBugReport is not called - mLooper.dispatchAll(); - verify(mWifiStateMachine, times(0)).takeBugReport(anyString(), anyString()); - } - - /** - * Case 30: Test connection success after wifi restart with a previously failing SSID - * Setup 1 network. Fail the network until watchcdog triggers. Trigger a connection success on - * a network which has the same SSID than the network that has been failing. - * Expected behavior: bugreport is triggered - */ - @Test - public void testConnectionSuccessWithPreviouslyFailingSsidTriggersBugreport() { - String[] ssids = {"\"test1\""}; - String[] bssids = {"6c:f3:7f:ae:8c:f3"}; - int[] frequencies = {2437}; - String[] caps = {"[WPA2-EAP-CCMP][ESS]"}; - int[] levels = {-60}; - boolean[] isEphemeral = {false}; - boolean[] hasEverConnected = {true}; - List<Pair<ScanDetail, WifiConfiguration>> candidates = createFilteredQnsCandidates(ssids, - bssids, frequencies, caps, levels, isEphemeral, hasEverConnected); - mLastResortWatchdog.updateAvailableNetworks(candidates); - - // Ensure new networks have zero'ed failure counts - for (int i = 0; i < ssids.length; i++) { - assertFailureCountEquals(bssids[i], 0, 0, 0); - } - - //Increment failure counts - for (int i = 0; i < WifiLastResortWatchdog.FAILURE_THRESHOLD; i++) { - mLastResortWatchdog.noteConnectionFailureAndTriggerIfNeeded( - ssids[0], bssids[0], WifiLastResortWatchdog.FAILURE_CODE_ASSOCIATION); - } - - // Verify relevant WifiMetrics calls were made once with appropriate arguments - verify(mWifiMetrics, times(1)).incrementNumLastResortWatchdogTriggers(); - - // Simulate wifi connecting after triggering - mLastResortWatchdog.connectedStateTransition(true, "\"test1\""); - // Verify takeBugReport is called - mLooper.dispatchAll(); - verify(mWifiStateMachine, times(1)).takeBugReport(anyString(), anyString()); - - // Simulate wifi connecting after triggering - mLastResortWatchdog.connectedStateTransition(true, "\"test1\""); - // Verify takeBugReport is not called again - mLooper.dispatchAll(); - verify(mWifiStateMachine, times(1)).takeBugReport(anyString(), anyString()); - } - - - /** * Test metrics incrementing connection failure count after watchdog has already been triggered */ @Test @@ -1902,14 +1808,14 @@ public class WifiLastResortWatchdogTest { ssids[0], bssids[0], WifiLastResortWatchdog.FAILURE_CODE_ASSOCIATION); // Simulate wifi connecting after triggering - mLastResortWatchdog.connectedStateTransition(true, "\"test1\""); + mLastResortWatchdog.connectedStateTransition(true); // Verify takeBugReport is not called again mLooper.dispatchAll(); verify(mWifiStateMachine, never()).takeBugReport(anyString(), anyString()); verify(mWifiMetrics, never()).incrementNumLastResortWatchdogSuccesses(); // Simulate wifi disconnecting - mLastResortWatchdog.connectedStateTransition(false, "\"test1\""); + mLastResortWatchdog.connectedStateTransition(false); // Test another round, and this time successfully connect after restart trigger for (int i = 0; i < ssids.length; i++) { @@ -1923,7 +1829,7 @@ public class WifiLastResortWatchdogTest { // Verify watchdog has triggered a restart verify(mWifiMetrics, times(2)).incrementNumLastResortWatchdogTriggers(); // Simulate wifi connecting after triggering - mLastResortWatchdog.connectedStateTransition(true, "\"test1\""); + mLastResortWatchdog.connectedStateTransition(true); // Verify takeBugReport is not called again mLooper.dispatchAll(); verify(mWifiStateMachine, times(1)).takeBugReport(anyString(), anyString()); @@ -1970,7 +1876,7 @@ public class WifiLastResortWatchdogTest { when(candidates.get(0).second.getNetworkSelectionStatus().getHasEverConnected()) .thenReturn(false); - mLastResortWatchdog.connectedStateTransition(true, "\"test1\""); + mLastResortWatchdog.connectedStateTransition(true); // Verify takeBugReport is not called again mLooper.dispatchAll(); verify(mWifiStateMachine, never()).takeBugReport(anyString(), anyString()); |