From 70232ae5577795c1ce8aac561177258f9b6a1e45 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Fri, 13 Sep 2019 14:00:12 -0700 Subject: WifiThreadRunner: call() should accept a value to be returned on timeout Bug: 141003746 Test: atest com.android.server.wifi Change-Id: I045c78cfeb4135b6fcc09eabe2ca8f2b8d53aa4e --- .../src/com/android/server/wifi/WifiThreadRunnerTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests') 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(); } -- cgit v1.2.3