Home
last modified time | relevance | path

Searched refs:mockContext (Results 1 – 20 of 20) sorted by relevance

/frameworks/base/tests/net/java/android/net/
DNetworkTemplateTest.kt51 private val mockContext = mock(Context::class.java) constant in android.net.NetworkTemplateTest
99 mockContext, stateMobile, false, TelephonyManager.NETWORK_TYPE_UMTS) in testRatTypeGroupMatches()
101 mockContext, stateMobile, false, TelephonyManager.NETWORK_TYPE_HSDPA) in testRatTypeGroupMatches()
103 mockContext, stateMobile, false, TelephonyManager.NETWORK_TYPE_LTE) in testRatTypeGroupMatches()
105 mockContext, stateMobile, false, SUBTYPE_COMBINED) in testRatTypeGroupMatches()
106 val identImsi2 = buildNetworkIdentity(mockContext, buildMobileNetworkState(TEST_IMSI2), in testRatTypeGroupMatches()
109 mockContext, buildWifiNetworkState(TEST_SSID1), true, 0) in testRatTypeGroupMatches()
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/settings/
DCurrentUserContextTrackerTest.kt52 val mockContext = mock(Context::class.java) in setUp() constant
53 `when`(mockContext.user).thenReturn(user) in setUp()
54 `when`(mockContext.userId).thenReturn(user.identifier) in setUp()
55 return mockContext in setUp()
/frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/
DValidateNotificationPeopleTest.java191 final Context mockContext = mock(Context.class); in testSearchContacts_workContact_queriesWorkContactProvider() local
192 when(mockContext.getUserId()).thenReturn(personalUserId); in testSearchContacts_workContact_queriesWorkContactProvider()
194 when(mockContext.getSystemService(UserManager.class)).thenReturn(mockUserManager); in testSearchContacts_workContact_queriesWorkContactProvider()
199 when(mockContext.getContentResolver()).thenReturn(mockContentResolver); in testSearchContacts_workContact_queriesWorkContactProvider()
204 new ValidateNotificationPeople().searchContacts(mockContext, lookupUri); in testSearchContacts_workContact_queriesWorkContactProvider()
222 final Context mockContext = mock(Context.class); in testSearchContacts_personalContact_queriesPersonalContactProvider() local
223 when(mockContext.getUserId()).thenReturn(personalUserId); in testSearchContacts_personalContact_queriesPersonalContactProvider()
225 when(mockContext.getSystemService(UserManager.class)).thenReturn(mockUserManager); in testSearchContacts_personalContact_queriesPersonalContactProvider()
227 when(mockContext.getContentResolver()).thenReturn(mockContentResolver); in testSearchContacts_personalContact_queriesPersonalContactProvider()
231 new ValidateNotificationPeople().searchContacts(mockContext, lookupUri); in testSearchContacts_personalContact_queriesPersonalContactProvider()
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/broadcast/
DBroadcastDispatcherTest.kt66 private lateinit var mockContext: Context in capture() variable in com.android.systemui.broadcast.BroadcastDispatcherTest
99 mockContext, in capture()
109 setUserMock(mockContext, user0) in capture()
184 broadcastDispatcher.onReceive(mockContext, intent) in testRegisterCurrentAsActualUser()
242 private fun setUserMock(mockContext: Context, user: UserHandle) { in setUserMock()
243 `when`(mockContext.user).thenReturn(user) in setUserMock()
244 `when`(mockContext.userId).thenReturn(user.identifier) in setUserMock()
DUserBroadcastDispatcherTest.kt65 private lateinit var mockContext: Context in capture() variable in com.android.systemui.broadcast.UserBroadcastDispatcherTest
84 mockContext, USER_ID, testableLooper.looper, mock(Executor::class.java), logger) { in capture()
/frameworks/base/core/tests/coretests/src/android/app/timezone/
DRulesUpdaterContractTest.java60 Context mockContext = mock(Context.class); in sendBroadcast() local
62 RulesUpdaterContract.sendBroadcast(mockContext, packageName, tokenBytes); in sendBroadcast()
64 verify(mockContext).sendBroadcastAsUser( in sendBroadcast()
/frameworks/base/wifi/tests/src/android/net/wifi/
DWifiNetworkScoreCacheTest.java66 @Mock private Context mockContext; // isn't used, can be null field in WifiNetworkScoreCacheTest
102 when(mockContext.getApplicationContext()).thenReturn(mockApplicationContext); in setUp()
105 mScoreCache = new WifiNetworkScoreCache(mockContext); in setUp()
193 mScoreCache = new WifiNetworkScoreCache(mockContext, mCacheListener); in updateScoresShouldInvokeCacheListener_networkCacheUpdated()
208 mScoreCache = new WifiNetworkScoreCache(mockContext, mCacheListener, 2 /* maxCacheSize */); in leastRecentlyUsedScore_shouldBeEvictedFromCache()
/frameworks/base/services/tests/servicestests/src/com/android/server/search/
DSearchablesTest.java102 MyMockContext mockContext = new MyMockContext(mContext, mockPM); in testSearchablesListReal() local
106 Searchables searchables = new Searchables(mockContext, 0); in testSearchablesListReal()
122 MyMockContext mockContext = new MyMockContext(mContext, mockPM); in testSearchablesListEmpty() local
125 Searchables searchables = new Searchables(mockContext, 0); in testSearchablesListEmpty()
/frameworks/base/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/
DBluetoothEventManagerTest.java99 Context mockContext = mock(Context.class); in ifUserHandleIsNull_registerReceiverIsCalled() local
101 new BluetoothEventManager(mLocalAdapter, mCachedDeviceManager, mockContext, in ifUserHandleIsNull_registerReceiverIsCalled()
104 verify(mockContext).registerReceiver(any(BroadcastReceiver.class), any(IntentFilter.class), in ifUserHandleIsNull_registerReceiverIsCalled()
110 Context mockContext = mock(Context.class); in ifUserHandleSpecified_registerReceiverAsUserIsCalled() local
112 new BluetoothEventManager(mLocalAdapter, mCachedDeviceManager, mockContext, in ifUserHandleSpecified_registerReceiverAsUserIsCalled()
115 verify(mockContext).registerReceiverAsUser(any(BroadcastReceiver.class), eq(UserHandle.ALL), in ifUserHandleSpecified_registerReceiverAsUserIsCalled()
/frameworks/base/core/tests/coretests/src/android/os/
DVibrationEffectTest.java72 Context context = mockContext(r); in getRingtones_noPrebakedRingtones()
80 Context context = mockContext(r); in getRingtones_noPrebakedRingtoneForUri()
88 Context context = mockContext(r); in getRingtones_getPrebakedRingtone()
252 private Context mockContext(Resources resources) {
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/rtt/
DRttServiceImplTest.java134 public Context mockContext; field in RttServiceImplTest
188 mDut = new RttServiceImplSpy(mockContext); in setUp()
192 when(mockContext.checkCallingOrSelfPermission( in setUp()
196 when(mockContext.getResources()).thenReturn(mMockResources); in setUp()
201 when(mockContext.getSystemService(Context.ALARM_SERVICE)) in setUp()
203 mInOrder = inOrder(mAlarmManager.getAlarmManager(), mockContext); in setUp()
205 when(mockContext.getSystemService(Context.ACTIVITY_SERVICE)).thenReturn( in setUp()
218 mMockPowerManager = new PowerManager(mockContext, mock(IPowerManager.class), in setUp()
221 when(mockContext.getSystemServiceName(PowerManager.class)).thenReturn( in setUp()
223 when(mockContext.getSystemService(PowerManager.class)).thenReturn(mMockPowerManager); in setUp()
[all …]
/frameworks/base/wifi/tests/src/android/net/wifi/rtt/
DWifiRttManagerTest.java60 public Context mockContext; field in WifiRttManagerTest
69 mDut = new WifiRttManager(mockContext, mockRttService); in setUp()
73 when(mockContext.getOpPackageName()).thenReturn(packageName); in setUp()
74 when(mockContext.getAttributionTag()).thenReturn(featureId); in setUp()
/frameworks/base/services/tests/servicestests/src/com/android/server/people/prediction/
DShareTargetPredictorTest.java393 Context mockContext = mock(Context.class); in buildShortcut() local
394 when(mockContext.getPackageName()).thenReturn(packageName); in buildShortcut()
395 when(mockContext.getUserId()).thenReturn(USER_ID); in buildShortcut()
396 when(mockContext.getUser()).thenReturn(UserHandle.of(USER_ID)); in buildShortcut()
397 ShortcutInfo.Builder builder = new ShortcutInfo.Builder(mockContext, shortcutId) in buildShortcut()
/frameworks/base/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/
DTetheringNotificationUpdaterTest.kt81 @Mock private lateinit var mockContext: Context variable in com.android.networkstack.tethering.TetheringNotificationUpdaterTest
99 if (user == UserHandle.ALL) mockContext else this in createContextAsUser()
136 doReturn(notificationManager).`when`(mockContext) in setUp()
/frameworks/base/core/tests/coretests/src/android/content/pm/
DCrossProfileAppsTest.java74 public void mockContext() { in mockContext() method in CrossProfileAppsTest
/frameworks/base/services/tests/PackageManagerComponentOverrideTests/src/com/android/server/pm/test/override/
DPackageManagerComponentLabelIconOverrideTest.kt335 val mockContext: Context = mockThrowOnUnmocked { in <lambda>() constant
347 whenever(this.context) { mockContext } in <lambda>()
/frameworks/base/services/tests/servicestests/src/com/android/server/people/data/
DDataManagerTest.java847 Context mockContext = mock(Context.class); in buildShortcutInfo() local
848 when(mockContext.getPackageName()).thenReturn(packageName); in buildShortcutInfo()
849 when(mockContext.getUserId()).thenReturn(userId); in buildShortcutInfo()
850 when(mockContext.getUser()).thenReturn(UserHandle.of(userId)); in buildShortcutInfo()
851 ShortcutInfo.Builder builder = new ShortcutInfo.Builder(mockContext, id) in buildShortcutInfo()
/frameworks/base/wifi/tests/src/android/net/wifi/aware/
DWifiAwareManagerTest.java74 public Context mockContext; field in WifiAwareManagerTest
117 when(mockContext.getOpPackageName()).thenReturn("XXX"); in setUp()
118 when(mockContext.getPackageManager()).thenReturn(mockPackageManager); in setUp()
120 mDut = new WifiAwareManager(mockContext, mockAwareService); in setUp()
/frameworks/base/services/tests/servicestests/src/com/android/server/accounts/
DAccountManagerServiceTest.java165 MyMockContext mockContext = new MyMockContext(realTestContext, mMockContext); in setUp() local
166 setContext(mockContext); in setUp()
167 mTestInjector = new TestInjector(realTestContext, mockContext, mMockNotificationManager); in setUp()
3211 MyMockContext(Context testContext, Context mockContext) { in MyMockContext() argument
3213 this.mMockContext = mockContext; in MyMockContext()
3312 Context mockContext, in TestInjector() argument
3314 super(mockContext); in TestInjector()
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/
DWifiConnectivityManagerTest.java100 mContext = mockContext(); in setUp()
254 Context mockContext() { in mockContext() method in WifiConnectivityManagerTest