Home
last modified time | relevance | path

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

/frameworks/base/tests/vcn/java/com/android/server/vcn/
DVcnTestUtils.java29 Context mockContext, Object service, String name, Class<?> serviceClass) { in setupSystemService() argument
30 doReturn(name).when(mockContext).getSystemServiceName(serviceClass); in setupSystemService()
31 doReturn(service).when(mockContext).getSystemService(name); in setupSystemService()
35 public static IpSecManager setupIpSecManager(Context mockContext, IpSecService service) { in setupIpSecManager() argument
36 doReturn(Context.IPSEC_SERVICE).when(mockContext).getSystemServiceName(IpSecManager.class); in setupIpSecManager()
38 final IpSecManager ipSecMgr = new IpSecManager(mockContext, service); in setupIpSecManager()
39 doReturn(ipSecMgr).when(mockContext).getSystemService(Context.IPSEC_SERVICE); in setupIpSecManager()
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/globalactions/
DGlobalActionsInfoProviderTest.kt62 @Mock private lateinit var mockContext: Context in eq() variable in com.google.android.systemui.globalactions.GlobalActionsInfoProviderTest
72 mockContext = spy(context) in eq()
74 whenever(mockContext.resources).thenReturn(mockResources) in eq()
77 whenever(mockContext.getSharedPreferences(eq(PREFERENCE), anyInt())) in eq()
85 mockContext, in eq()
123 infoProvider.addPanel(mockContext, parent, 5, { }) in eq()
/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/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/packages/SystemUI/tests/src/com/android/systemui/media/
DMediaResumeListenerTest.kt88 @Mock private lateinit var mockContext: Context in capture() variable in com.android.systemui.media.MediaResumeListenerTest
117 whenever(mockContext.getSharedPreferences(eq(MEDIA_PREFERENCES), anyInt())) in capture()
122 whenever(mockContext.packageManager).thenReturn(context.packageManager) in capture()
123 whenever(mockContext.contentResolver).thenReturn(context.contentResolver) in capture()
126 resumeListener = MediaResumeListener(mockContext, broadcastDispatcher, executor, in capture()
190 whenever(mockContext.packageManager).thenReturn(pm) in capture()
225 whenever(mockContext.packageManager).thenReturn(pm) in capture()
300 whenever(mockContext.packageManager).thenReturn(pm) in capture()
/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
101 mockContext, in capture()
112 setUserMock(mockContext, user0) in capture()
241 private fun setUserMock(mockContext: Context, user: UserHandle) { in setUserMock()
242 `when`(mockContext.user).thenReturn(user) in setUserMock()
243 `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/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/packages/SystemUI/tests/src/com/android/systemui/qs/external/
DCustomTileStatePersisterTest.kt68 private lateinit var mockContext: Context variable in com.android.systemui.qs.external.CustomTileStatePersisterTest
82 `when`(mockContext.getSharedPreferences(anyString(), anyInt())) in setUp()
87 customTileStatePersister = CustomTileStatePersister(mockContext) in setUp()
/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.java106 Context mockContext = mock(Context.class); in ifUserHandleIsNull_registerReceiverIsCalled() local
108 new BluetoothEventManager(mLocalAdapter, mCachedDeviceManager, mockContext, in ifUserHandleIsNull_registerReceiverIsCalled()
111 verify(mockContext).registerReceiver(any(BroadcastReceiver.class), any(IntentFilter.class), in ifUserHandleIsNull_registerReceiverIsCalled()
117 Context mockContext = mock(Context.class); in ifUserHandleSpecified_registerReceiverAsUserIsCalled() local
119 new BluetoothEventManager(mLocalAdapter, mCachedDeviceManager, mockContext, in ifUserHandleSpecified_registerReceiverAsUserIsCalled()
122 verify(mockContext).registerReceiverAsUser(any(BroadcastReceiver.class), eq(UserHandle.ALL), in ifUserHandleSpecified_registerReceiverAsUserIsCalled()
/frameworks/base/core/tests/coretests/src/android/os/
DVibrationEffectTest.java70 Context context = mockContext(r); in getRingtones_noPrebakedRingtones()
78 Context context = mockContext(r); in getRingtones_noPrebakedRingtoneForUri()
86 Context context = mockContext(r); in getRingtones_getPrebakedRingtone()
330 private Context mockContext(Resources resources) { in mockContext() method in VibrationEffectTest
/frameworks/base/services/tests/servicestests/src/com/android/server/people/prediction/
DShareTargetPredictorTest.java423 Context mockContext = mock(Context.class); in buildShortcut() local
424 when(mockContext.getPackageName()).thenReturn(packageName); in buildShortcut()
425 when(mockContext.getUserId()).thenReturn(USER_ID); in buildShortcut()
426 when(mockContext.getUser()).thenReturn(UserHandle.of(USER_ID)); in buildShortcut()
427 ShortcutInfo.Builder builder = new ShortcutInfo.Builder(mockContext, shortcutId) in buildShortcut()
/frameworks/base/core/tests/coretests/src/android/content/pm/
DCrossProfileAppsTest.java74 public void mockContext() { in mockContext() method in CrossProfileAppsTest
/frameworks/base/services/tests/mockingservicestests/src/com/android/server/pm/dex/
DDexManagerTests.java151 Context mockContext = ExtendedMockito.mock(Context.class); in setup() local
153 .when(mockContext) in setup()
156 .when(mockContext) in setup()
159 .when(mockContext) in setup()
162 mDexManager = new DexManager(mockContext, mPM, /*PackageDexOptimizer*/ null, in setup()
/frameworks/base/services/tests/PackageManagerComponentOverrideTests/src/com/android/server/pm/test/override/
DPackageManagerComponentLabelIconOverrideTest.kt356 val mockContext: Context = mockThrowOnUnmocked { in <lambda>() constant
374 whenever(this.context) { mockContext } in <lambda>()
/frameworks/base/services/tests/servicestests/src/com/android/server/people/data/
DDataManagerTest.java1557 Context mockContext = mock(Context.class); in buildShortcutInfo() local
1558 when(mockContext.getPackageName()).thenReturn(packageName); in buildShortcutInfo()
1559 when(mockContext.getUserId()).thenReturn(userId); in buildShortcutInfo()
1560 when(mockContext.getUser()).thenReturn(UserHandle.of(userId)); in buildShortcutInfo()
1561 ShortcutInfo.Builder builder = new ShortcutInfo.Builder(mockContext, id) in buildShortcutInfo()
/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()
3342 MyMockContext(Context testContext, Context mockContext) { in MyMockContext() argument
3344 this.mMockContext = mockContext; in MyMockContext()
3443 Context mockContext, in TestInjector() argument
3445 super(mockContext); in TestInjector()