summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-09-13 14:00:12 -0700
committerRoshan Pius <rpius@google.com>2019-09-19 13:21:51 -0700
commit70232ae5577795c1ce8aac561177258f9b6a1e45 (patch)
tree33c0cf29dc2a04c2e68c221cb98ae640d14cd5b2 /tests
parent3d7b0e525b0b8115de923d25549dc6de8524988e (diff)
WifiThreadRunner: call() should accept a value to be returned on timeout
Bug: 141003746 Test: atest com.android.server.wifi Change-Id: I045c78cfeb4135b6fcc09eabe2ca8f2b8d53aa4e
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiThreadRunnerTest.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiThreadRunnerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiThreadRunnerTest.java
index cd3aff397..7a051e2a8 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiThreadRunnerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiThreadRunnerTest.java
@@ -43,6 +43,7 @@ import java.util.function.Supplier;
public class WifiThreadRunnerTest {
private static final int RESULT = 2;
+ private static final int VALUE_ON_TIMEOUT = -1;
private WifiThreadRunner mWifiThreadRunner;
@@ -76,19 +77,19 @@ public class WifiThreadRunnerTest {
return true;
}).when(mHandler).runWithScissors(any(), anyLong());
- Integer result = mWifiThreadRunner.call(mSupplier);
+ Integer result = mWifiThreadRunner.call(mSupplier, VALUE_ON_TIMEOUT);
assertThat(result).isEqualTo(RESULT);
verify(mSupplier).get();
}
@Test
- public void callFailure_returnNull() {
+ public void callFailure_returnValueOnTimeout() {
doReturn(false).when(mHandler).runWithScissors(any(), anyLong());
- Integer result = mWifiThreadRunner.call(mSupplier);
+ Integer result = mWifiThreadRunner.call(mSupplier, VALUE_ON_TIMEOUT);
- assertThat(result).isNull();
+ assertThat(result).isEqualTo(VALUE_ON_TIMEOUT);
verify(mSupplier, never()).get();
}