diff options
author | Roshan Pius <rpius@google.com> | 2019-11-24 06:57:07 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-11-24 06:57:07 +0000 |
commit | 6abce0f40c2f25ed2fedf1d7600a9fe0b8bb4126 (patch) | |
tree | bd60c47d3372367831927f3339161591242923fc /tests | |
parent | ca845b488900d7d8ddc2fac7b4e61185e69f3649 (diff) | |
parent | 9ddb074cf86618457489e0de156cfb7fd2dcf3b1 (diff) |
Merge "ScoredNetworkEvaluator: Use new @SystemApi for NetworkScoreManager"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/ScoredNetworkEvaluatorTest.java | 10 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ScoredNetworkEvaluatorTest.java b/tests/wifitests/src/com/android/server/wifi/ScoredNetworkEvaluatorTest.java index bff45c99b..cae97dfd3 100644 --- a/tests/wifitests/src/com/android/server/wifi/ScoredNetworkEvaluatorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ScoredNetworkEvaluatorTest.java @@ -24,6 +24,8 @@ import static org.junit.Assert.*; import static org.mockito.Mockito.*; import android.content.Context; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; import android.database.ContentObserver; import android.net.NetworkKey; import android.net.NetworkScoreManager; @@ -72,6 +74,7 @@ public class ScoredNetworkEvaluatorTest extends WifiBaseTest { @Mock private Clock mClock; @Mock private FrameworkFacade mFrameworkFacade; @Mock private NetworkScoreManager mNetworkScoreManager; + @Mock private PackageManager mPackageManager; @Mock private WifiConfigManager mWifiConfigManager; @Mock private WifiPermissionsUtil mWifiPermissionsUtil; @Mock private OnConnectableListener mOnConnectableListener; @@ -91,13 +94,18 @@ public class ScoredNetworkEvaluatorTest extends WifiBaseTest { when(mFrameworkFacade.getIntegerSetting(mContext, Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED, 0)) .thenReturn(1); + ApplicationInfo appInfo = new ApplicationInfo(); + appInfo.uid = TEST_UID; + when(mPackageManager.getApplicationInfo(any(), anyInt())) + .thenReturn(appInfo); ArgumentCaptor<ContentObserver> observerCaptor = ArgumentCaptor.forClass(ContentObserver.class); mScoreCache = new WifiNetworkScoreCache(mContext); mScoredNetworkEvaluator = new ScoredNetworkEvaluator(mContext, new Handler(Looper.getMainLooper()), mFrameworkFacade, mNetworkScoreManager, - mWifiConfigManager, new LocalLog(0), mScoreCache, mWifiPermissionsUtil); + mPackageManager, mWifiConfigManager, new LocalLog(0), mScoreCache, + mWifiPermissionsUtil); verify(mFrameworkFacade).registerContentObserver(eq(mContext), any(Uri.class), eq(false), observerCaptor.capture()); mContentObserver = observerCaptor.getValue(); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java index ddb49f0b1..a916a2bd6 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java @@ -111,6 +111,7 @@ import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.net.wifi.WifiManager.LocalOnlyHotspotCallback; import android.net.wifi.WifiManager.SoftApCallback; +import android.net.wifi.WifiNetworkScoreCache; import android.net.wifi.WifiNetworkSuggestion; import android.net.wifi.WifiSsid; import android.net.wifi.WifiStackClient; @@ -342,6 +343,8 @@ public class WifiServiceImplTest extends WifiBaseTest { when(mClientModeImpl.getWifiScoreReport()).thenReturn(mWifiScoreReport); when(mWifiInjector.getWifiScoreCard()).thenReturn(mWifiScoreCard); when(mWifiInjector.getSarManager()).thenReturn(mSarManager); + when(mWifiInjector.getWifiNetworkScoreCache()) + .thenReturn(mock(WifiNetworkScoreCache.class)); when(mWifiInjector.getWifiThreadRunner()) .thenReturn(new WifiThreadRunner(new Handler(mLooper.getLooper()))); when(mClientModeImpl.syncStartSubscriptionProvisioning(anyInt(), |