diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-06-11 05:30:37 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-06-11 05:30:37 +0000 |
commit | 9b3cb9cd950e4330767a111b31543f50d20eb43c (patch) | |
tree | 1321ffc381ab34a8e938a2f6de97897a4a3f471c /tests | |
parent | 75846b434a43fff148753d7aba88e4727abd5ec0 (diff) | |
parent | a4fc5402d0a52aff7092160b7e73d071a53ef4a4 (diff) |
Merge "WifiDiagnostics: Remove blocking call to readLine()" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java index 6b235b9f7..c89fe675a 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java @@ -26,6 +26,7 @@ import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.contains; import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.anyObject; +import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.never; @@ -72,6 +73,7 @@ public class WifiDiagnosticsTest extends WifiBaseTest { @Mock WifiMetrics mWifiMetrics; @Mock Clock mClock; @Mock BugreportManager mBugreportManager; + private long mBootTimeMs = 0L; MockResources mResources; WifiDiagnostics mWifiDiagnostics; @@ -135,6 +137,13 @@ public class WifiDiagnosticsTest extends WifiBaseTest { when(mWifiInjector.getWifiMetrics()).thenReturn(mWifiMetrics); when(mWifiInjector.getDeviceConfigFacade()).thenReturn(mDeviceConfigFacade); when(mDeviceConfigFacade.getBugReportMinWindowMs()).thenReturn(BUG_REPORT_MIN_WINDOW_MS); + // needed to for the loop in WifiDiagnostics.readLogcatStreamLinesWithTimeout(). + doAnswer(new AnswerWithArguments() { + public long answer() throws Exception { + mBootTimeMs += WifiDiagnostics.LOGCAT_READ_TIMEOUT_MILLIS / 2; + return mBootTimeMs; + } + }).when(mClock).getElapsedSinceBootMillis(); mWifiDiagnostics = new WifiDiagnostics( mContext, mWifiInjector, mWifiNative, mBuildProperties, mLastMileLogger, mClock); mWifiNative.enableVerboseLogging(0); |