diff options
author | Oscar Shu <xshu@google.com> | 2019-05-29 17:38:22 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-05-29 17:38:22 +0000 |
commit | d730fef342daccb305f4cc20576c98601d05e44b (patch) | |
tree | 09cb6eaada681caf9b878869109cc8227d3ee329 /tests | |
parent | 8a2a97976f1ad31b0981abc134139a3252ea13f2 (diff) | |
parent | d3e3342fb016e6f92202322abc9040eb29e96883 (diff) |
Merge "Revert "Trigger bugreport for abnormally long connections"" into qt-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java b/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java index dab283539..9ae382640 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java @@ -24,7 +24,6 @@ import static org.mockito.MockitoAnnotations.*; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.net.wifi.WifiSsid; -import android.os.Handler; import android.os.test.TestLooper; import android.util.Pair; @@ -73,7 +72,6 @@ public class WifiLastResortWatchdogTest { mLastResortWatchdog.setBugReportProbability(1); when(mClientModeImpl.getWifiInfo()).thenReturn(mWifiInfo); when(mWifiInfo.getSSID()).thenReturn(TEST_NETWORK_SSID); - when(mWifiInjector.getClientModeImplHandler()).thenReturn(mLastResortWatchdog.getHandler()); } private List<Pair<ScanDetail, WifiConfiguration>> createFilteredQnsCandidates(String[] ssids, @@ -2154,41 +2152,4 @@ public class WifiLastResortWatchdogTest { verify(mWifiMetrics, times(1)).incrementNumLastResortWatchdogSuccesses(); } - /** - * Verifies that when a connection takes too long (time difference between - * StaEvent.TYPE_CMD_START_CONNECT and StaEvent.TYPE_NETWORK_CONNECTION_EVENT) a bugreport is - * taken. - */ - @Test - public void testAbnormalConnectionTimeTriggersBugreport() throws Exception { - // first verifies that bugreports are not taken when connection takes less than - // WifiLastResortWatchdog.ABNORMAL_SUCCESSFUL_CONNECTION_DURATION_MS - when(mClock.getElapsedSinceBootMillis()).thenReturn(1L); - mLastResortWatchdog.noteStartConnectTime(); - when(mClock.getElapsedSinceBootMillis()).thenReturn( - (long) WifiLastResortWatchdog.ABNORMAL_SUCCESSFUL_CONNECTION_DURATION_MS); - Handler handler = mLastResortWatchdog.getHandler(); - handler.sendMessage( - handler.obtainMessage(WifiMonitor.NETWORK_CONNECTION_EVENT, 0, 0, null)); - mLooper.dispatchAll(); - verify(mClientModeImpl, never()).takeBugReport(anyString(), anyString()); - - // Now verify that bugreport is taken - mLastResortWatchdog.noteStartConnectTime(); - when(mClock.getElapsedSinceBootMillis()).thenReturn( - (long) 2 * WifiLastResortWatchdog.ABNORMAL_SUCCESSFUL_CONNECTION_DURATION_MS + 1); - handler.sendMessage( - handler.obtainMessage(WifiMonitor.NETWORK_CONNECTION_EVENT, 0, 0, null)); - mLooper.dispatchAll(); - verify(mClientModeImpl).takeBugReport(anyString(), anyString()); - - // Verify additional connections (without more TYPE_CMD_START_CONNECT) don't trigger more - // bugreports. - when(mClock.getElapsedSinceBootMillis()).thenReturn( - (long) 4 * WifiLastResortWatchdog.ABNORMAL_SUCCESSFUL_CONNECTION_DURATION_MS); - handler.sendMessage( - handler.obtainMessage(WifiMonitor.NETWORK_CONNECTION_EVENT, 0, 0, null)); - mLooper.dispatchAll(); - verify(mClientModeImpl).takeBugReport(anyString(), anyString()); - } } |