diff options
author | Erik Kline <ek@google.com> | 2016-10-04 07:50:09 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-10-04 07:50:09 +0000 |
commit | 21ee92657d93e91a136be68db7f20d9a0deafc94 (patch) | |
tree | 85502f61643ca61582c44d3b6e26d30fc184ff9f /tests | |
parent | d047bcf42defa4aa49100f0399b4628a5f12c90c (diff) | |
parent | 7209c17994c0b3bdc7c22bc312395f9aa124c231 (diff) | |
download | android_frameworks_opt_net_wifi-21ee92657d93e91a136be68db7f20d9a0deafc94.tar.gz android_frameworks_opt_net_wifi-21ee92657d93e91a136be68db7f20d9a0deafc94.tar.bz2 android_frameworks_opt_net_wifi-21ee92657d93e91a136be68db7f20d9a0deafc94.zip |
Add more capable Settings abstractions to accomodate IpManager am: 4dbd44f394
am: 7209c17994
Change-Id: Ic247f99e1e8e9e1ed6422ecfcdeec83654b3dbe9
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java index 636c93d87..f3fe0cda2 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.*; import android.app.ActivityManager; +import android.content.ContentProvider; import android.content.ContentResolver; import android.content.Context; import android.content.pm.PackageManager; @@ -41,6 +42,7 @@ import android.net.wifi.WifiSsid; import android.net.wifi.p2p.IWifiP2pManager; import android.os.BatteryStats; import android.os.Binder; +import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.os.IBinder; @@ -56,6 +58,8 @@ import android.os.UserManager; import android.provider.Settings; import android.security.KeyStore; import android.telephony.TelephonyManager; +import android.test.mock.MockContentProvider; +import android.test.mock.MockContentResolver; import android.test.suitebuilder.annotation.SmallTest; import android.util.Base64; import android.util.Log; @@ -218,13 +222,19 @@ public class WifiStateMachineTest { Context context = mock(Context.class); when(context.getPackageManager()).thenReturn(pkgMgr); - when(context.getContentResolver()).thenReturn(mock(ContentResolver.class)); MockResources resources = new com.android.server.wifi.MockResources(); when(context.getResources()).thenReturn(resources); - ContentResolver cr = mock(ContentResolver.class); - when(context.getContentResolver()).thenReturn(cr); + MockContentResolver mockContentResolver = new MockContentResolver(); + mockContentResolver.addProvider(Settings.AUTHORITY, + new MockContentProvider(context) { + @Override + public Bundle call(String method, String arg, Bundle extras) { + return new Bundle(); + } + }); + when(context.getContentResolver()).thenReturn(mockContentResolver); when(context.getSystemService(Context.POWER_SERVICE)).thenReturn( new PowerManager(context, mock(IPowerManager.class), new Handler())); |