diff options
author | Ningyuan Wang <nywang@google.com> | 2017-08-03 16:51:00 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-08-03 16:51:00 +0000 |
commit | d8cab05bd605e4255dd6f77293329fbeb65b3249 (patch) | |
tree | 3c0f354c004180e3d09c7edc74490d57d94776aa /tests | |
parent | 184f668983529067537f6265f53700ad6120ecab (diff) | |
parent | 784d5bf21e29baab7c8c5a815897ffc476d6b099 (diff) |
Merge "Dump latest unfiltered scan result" into oc-dr1-dev
am: 784d5bf21e
Change-Id: Ic4996a875179ed615fd8a71bdb3b10b566cbc08b
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/scanner/WificondScannerTest.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/WificondScannerTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/WificondScannerTest.java index 3a5f6b973..ed7c58298 100644 --- a/tests/wifitests/src/com/android/server/wifi/scanner/WificondScannerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/scanner/WificondScannerTest.java @@ -37,8 +37,12 @@ import org.junit.Before; import org.junit.Test; import org.mockito.InOrder; +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.io.StringWriter; import java.util.ArrayList; import java.util.Set; +import java.util.regex.Pattern; /** * Unit tests for {@link com.android.server.wifi.scanner.WificondScannerImpl}. @@ -554,6 +558,28 @@ public class WificondScannerTest extends BaseWifiScannerImplTest { } /** + * Test that dump() of WificondScannerImpl dumps native scan results. + */ + @Test + public void dumpContainsNativeScanResults() { + assertDumpContainsRequestLog("Latest native scan results:"); + } + + private void assertDumpContainsRequestLog(String log) { + String objectDump = dumpObject(); + Pattern logLineRegex = Pattern.compile(".*" + log + ".*"); + assertTrue("dump did not contain log = " + log + "\n " + objectDump + "\n", + logLineRegex.matcher(objectDump).find()); + } + + private String dumpObject() { + StringWriter stringWriter = new StringWriter(); + mScanner.dump(new FileDescriptor(), new PrintWriter(stringWriter), + new String[0]); + return stringWriter.toString(); + } + + /** * Run a test with the given settings where all native scans succeed * This will execute expectedPeriods.length scan periods by first * starting the scan settings and then dispatching the scan period alarm to start the |