summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/scanner/WificondScannerTest.java26
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