summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-04-20 06:10:23 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-04-20 06:10:23 +0000
commit14f0d8af6e57d083d7ab77de5de4e49b94ca8c33 (patch)
tree772cb84a05fd848da9453e09315b0e9984b0a6ae /tests
parentd859819c298d65cb01aece60182d65057fc5b088 (diff)
parent398087d8757bed09b520e54f62780fc389f316a3 (diff)
Merge "WifiConfigManager: Handle file creation errors gracefully" into qt-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index 2f73ca7f0..8b79e9ed1 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -49,6 +49,7 @@ import android.util.Pair;
import androidx.test.filters.SmallTest;
+import com.android.dx.mockito.inline.extended.ExtendedMockito;
import com.android.internal.R;
import com.android.server.wifi.util.WifiPermissionsUtil;
import com.android.server.wifi.util.WifiPermissionsWrapper;
@@ -60,6 +61,7 @@ import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.mockito.MockitoSession;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -137,6 +139,7 @@ public class WifiConfigManagerTest {
private TestLooper mLooper = new TestLooper();
private ContentObserver mContentObserverPnoChannelCulling;
private ContentObserver mContentObserverPnoRecencySorting;
+ private MockitoSession mSession;
/**
* Setup the mocks and an instance of WifiConfigManager before each test.
@@ -219,6 +222,11 @@ public class WifiConfigManagerTest {
Settings.Global.WIFI_PNO_RECENCY_SORTING_ENABLED)), eq(false),
observerCaptor.capture());
mContentObserverPnoRecencySorting = observerCaptor.getValue();
+ // static mocking
+ mSession = ExtendedMockito.mockitoSession()
+ .mockStatic(WifiConfigStore.class, withSettings().lenient())
+ .startMocking();
+ when(WifiConfigStore.createUserFiles(anyInt())).thenReturn(mock(List.class));
}
/**
@@ -227,6 +235,7 @@ public class WifiConfigManagerTest {
@After
public void cleanup() {
validateMockitoUsage();
+ mSession.finishMocking();
}
/**