diff options
author | Rebecca Silberstein <silberst@google.com> | 2018-05-14 10:56:47 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-05-14 10:56:47 -0700 |
commit | 9f18d970a14c15f0710402611bd5d3de2d45330e (patch) | |
tree | cf3e2479d13f2705da9a2d243c9a3954729a7951 /tests | |
parent | c34614a12d12ac6bde619c580001be8d6ddee569 (diff) | |
parent | 8f42f8a94f6305e437188d29005e5b7589b94098 (diff) |
Merge "ActiveModeManager: add dump calls" into pi-dev
am: 8f42f8a94f
Change-Id: I319e4b2ad01b38ce63ca05e9efa76e5eb400ea8d
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiStateMachinePrimeTest.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachinePrimeTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachinePrimeTest.java index ec1c0e8fe..651c0f88d 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachinePrimeTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachinePrimeTest.java @@ -38,6 +38,9 @@ import org.mockito.MockitoAnnotations; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import java.io.ByteArrayOutputStream; +import java.io.PrintWriter; + /** * Unit tests for {@link com.android.server.wifi.WifiStateMachinePrime}. */ @@ -644,4 +647,32 @@ public class WifiStateMachinePrimeTest { verify(mSoftApStateMachineCallback).onStateChanged(WifiManager.WIFI_AP_STATE_DISABLED, 0); } + /** + * Verify that we do not crash when calling dump and wifi is fully disabled. + */ + @Test + public void dumpWhenWifiFullyOffDoesNotCrash() throws Exception { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(stream); + mWifiStateMachinePrime.dump(null, writer, null); + } + + /** + * Verify that we trigger dump on active mode managers. + */ + @Test + public void dumpCallsActiveModeManagers() throws Exception { + enterSoftApActiveMode(); + enterClientModeActiveState(); + enterScanOnlyModeActiveState(); + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + PrintWriter writer = new PrintWriter(stream); + mWifiStateMachinePrime.dump(null, writer, null); + + verify(mSoftApManager).dump(eq(null), eq(writer), eq(null)); + // can only be in scan or client, so we should not have a client mode active + verify(mClientModeManager, never()).dump(eq(null), eq(writer), eq(null)); + verify(mScanOnlyModeManager).dump(eq(null), eq(writer), eq(null)); + } } |