Home
last modified time | relevance | path

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

1234

/packages/modules/Connectivity/staticlibs/tests/unit/src/com/android/net/module/util/
DPermissionUtilsTest.kt64 private val mockContext = mock(Context::class.java) constant
71 doReturn(mockPackageManager).`when`(mockContext).packageManager in setup()
72 doReturn(mockContext).`when`(mockContext).createContextAsUser(any(), anyInt()) in setup()
77 doReturn(PERMISSION_GRANTED).`when`(mockContext) in testEnforceAnyPermissionOf()
79 doReturn(PERMISSION_DENIED).`when`(mockContext) in testEnforceAnyPermissionOf()
81 assertTrue(hasAnyPermissionOf(mockContext, TEST_PERMISSION1, TEST_PERMISSION2)) in testEnforceAnyPermissionOf()
82 enforceAnyPermissionOf(mockContext, TEST_PERMISSION1, TEST_PERMISSION2) in testEnforceAnyPermissionOf()
84 doReturn(PERMISSION_DENIED).`when`(mockContext) in testEnforceAnyPermissionOf()
86 doReturn(PERMISSION_GRANTED).`when`(mockContext) in testEnforceAnyPermissionOf()
88 assertTrue(hasAnyPermissionOf(mockContext, TEST_PERMISSION1, TEST_PERMISSION2)) in testEnforceAnyPermissionOf()
[all …]
/packages/apps/Nfc/tests/unit/src/com/android/nfc/cardemulation/
DHostNfcFEmulationManagerTest.java71 private Context mockContext; field in HostNfcFEmulationManagerTest
114 manager = new HostNfcFEmulationManager(mockContext, mockIdentifiersCache); in testConstructor()
116 assertThat(manager.mContext).isEqualTo(mockContext); in testConstructor()
126 manager = new HostNfcFEmulationManager(mockContext, mockIdentifiersCache); in testOnEnabledForegroundNfcFServiceChangedWithNonNullService()
137 manager = new HostNfcFEmulationManager(mockContext, mockIdentifiersCache); in testOnEnabledForegroundNfcFServiceChangedWithNullService()
144 verify(mockContext).unbindService(any(ServiceConnection.class)); in testOnEnabledForegroundNfcFServiceChangedWithNullService()
157 manager = new HostNfcFEmulationManager(mockContext, mockIdentifiersCache); in testOnHostEmulationDataWithNullDataAndNoActiveService_ReturnsEarly()
169 manager = new HostNfcFEmulationManager(mockContext, mockIdentifiersCache); in testOnHostEmulationDataWithDisabledResolvedServiceFromActiveService_ReturnsEarly()
182 manager = new HostNfcFEmulationManager(mockContext, mockIdentifiersCache); in testOnHostEmulationDataWithEnabledResolvedServiceFromCache_BindToService()
199 manager = new HostNfcFEmulationManager(mockContext, mockIdentifiersCache); in testOnHostEmulationDataWithValidExistingService_BindToService()
[all …]
/packages/apps/ManagedProvisioning/tests/instrumentation/src/com/android/managedprovisioning/common/
DUtilsTest.java75 @Mock private Context mockContext; field in UtilsTest
90 when(mockContext.getSystemService(Context.ACCOUNT_SERVICE)).thenReturn(mockAccountManager); in setUp()
91 when(mockContext.getPackageManager()).thenReturn(mockPackageManager); in setUp()
92 when(mockContext.getSystemService(Context.CONNECTIVITY_SERVICE)) in setUp()
151 assertTrue(mUtils.packageRequiresUpdate(TEST_PACKAGE_NAME_1, 0, mockContext)); in testPackageRequiresUpdate_notPresent()
163 assertFalse(mUtils.packageRequiresUpdate(TEST_PACKAGE_NAME_1, 0, mockContext)); in testPackageRequiresUpdate()
164 assertFalse(mUtils.packageRequiresUpdate(TEST_PACKAGE_NAME_1, 1, mockContext)); in testPackageRequiresUpdate()
165 assertTrue(mUtils.packageRequiresUpdate(TEST_PACKAGE_NAME_1, 2, mockContext)); in testPackageRequiresUpdate()
173 assertTrue(mUtils.isConnectedToNetwork(mockContext)); in testIsConnectedToNetwork()
179 assertTrue(mUtils.isConnectedToNetwork(mockContext)); in testIsConnectedToNetwork()
[all …]
/packages/modules/Connectivity/tests/unit/java/android/net/
DNetworkTemplateTest.kt77 private val mockContext = mock(Context::class.java) constant
130 val identMobileImsi1 = buildNetworkIdentity(mockContext, in testWifiWildcardMatches()
134 mockContext, buildWifiNetworkState(null, TEST_WIFI_KEY1), true, 0) in testWifiWildcardMatches()
136 mockContext, buildWifiNetworkState(TEST_IMSI1, TEST_WIFI_KEY1), true, 0) in testWifiWildcardMatches()
141 mockContext, buildWifiNetworkState(null /* subscriberId */, in testWifiWildcardMatches()
166 val identMobile1 = buildNetworkIdentity(mockContext, buildMobileNetworkState(TEST_IMSI1), in testWifiMatches()
169 mockContext, buildWifiNetworkState(null, TEST_WIFI_KEY1), true, 0) in testWifiMatches()
171 mockContext, buildWifiNetworkState(TEST_IMSI1, TEST_WIFI_KEY1), true, 0) in testWifiMatches()
173 mockContext, buildWifiNetworkState(TEST_IMSI2, TEST_WIFI_KEY1), true, 0) in testWifiMatches()
175 mockContext, buildWifiNetworkState(TEST_IMSI1, TEST_WIFI_KEY2), true, 0) in testWifiMatches()
[all …]
DNetworkIdentityTest.kt52 private val mockContext = mock(Context::class.java) in <lambda>() constant in android.net.NetworkIdentityTest
90 val netIdent1 = NetworkIdentity.buildNetworkIdentity(mockContext, in <lambda>()
99 val netIdent2 = NetworkIdentity.buildNetworkIdentity(mockContext, in <lambda>()
109 val netIdent3 = NetworkIdentity.buildNetworkIdentity(mockContext, in <lambda>()
130 val identFromLegacyBuild = NetworkIdentity.buildNetworkIdentity(mockContext, in <lambda>()
248 val netIdent1 = NetworkIdentity.buildNetworkIdentity(mockContext, in <lambda>()
253 val netIdent2 = NetworkIdentity.buildNetworkIdentity(mockContext, in <lambda>()
/packages/apps/CellBroadcastReceiver/tests/unit/src/com/android/cellbroadcastreceiver/unit/
DCellBroadcastSettingsTest.java192 Context mockContext = mock(Context.class); in testPreferenceChangeByUser() local
196 doReturn(mUserManager).when(mockContext).getSystemService(Context.USER_SERVICE); in testPreferenceChangeByUser()
198 doReturn(mMockedSharedPreference).when(mockContext).getSharedPreferences(anyString(), in testPreferenceChangeByUser()
203 fragment.onPreferenceChangedByUser(mockContext); in testPreferenceChangeByUser()
205 verify(mockContext, times(1)).startService(mIntent.capture()); in testPreferenceChangeByUser()
212 Context mockContext = mock(Context.class); in testGetResources() local
215 doReturn(mockResources).when(mockContext).getResources(); in testGetResources()
219 mockContext, SubscriptionManager.DEFAULT_SUBSCRIPTION_ID); in testGetResources()
220 verify(mockContext, never()).getSystemService(anyString()); in testGetResources()
221 verify(mockContext, times(1)).getResources(); in testGetResources()
[all …]
/packages/providers/MediaProvider/photopicker/tests/src/com/android/photopicker/core/user/
DUserMonitorTest.kt93 @Mock lateinit var mockContext: Context in <lambda>() variable in com.android.photopicker.core.user.UserMonitorTest
128 mockSystemService(mockContext, UserManager::class.java) { mockUserManager } in <lambda>()
129 whenever(mockContext.packageManager) { mockPackageManager } in <lambda>()
130 whenever(mockContext.contentResolver) { mockContentResolver } in <lambda>()
131 whenever(mockContext.createPackageContextAsUser(any(), anyInt(), any())) { mockContext } in <lambda>()
132 whenever(mockContext.createContextAsUser(any(UserHandle::class.java), anyInt())) { in <lambda>()
133 mockContext in <lambda>()
172 mockContext, in <lambda>()
210 mockContext, in <lambda>()
253 mockContext, in <lambda>()
[all …]
/packages/modules/AdServices/adservices/tests/unittest/service-core/src/com/android/adservices/service/common/
DPermissionHelperTest.java102 Context mockContext =
105 assertThat(PermissionHelper.hasAccessAdServicesStatePermission(mockContext)).isTrue();
115 Context mockContext =
118 assertThat(PermissionHelper.hasModifyAdServicesStatePermission(mockContext)).isTrue();
192 Context mockContext = getMockContext(FAKE_PERMISSION, mMockPackageManagerDeny);
195 mockContext, APP_PACKAGE_NAME, APP_CALLING_UID))
199 mockContext, APP_PACKAGE_NAME, APP_CALLING_UID))
201 assertThat(PermissionHelper.hasAttributionPermission(mockContext, APP_PACKAGE_NAME))
205 mockContext, APP_PACKAGE_NAME, ACCESS_ADSERVICES_CUSTOM_AUDIENCE))
209 mockContext, APP_PACKAGE_NAME, ACCESS_ADSERVICES_PROTECTED_SIGNALS))
[all …]
/packages/services/Car/tests/CustomizationTool/tests/src/com/android/car/customization/tool/domain/menu/
DMenuControllerTest.kt45 private lateinit var mockContext: Context variable in com.android.car.customization.tool.domain.menu.MenuControllerTest
58 val underTest = MenuController(fakeRootProvider, mockContext, mapOf()) in build_menu_test()
69 `when`(mockContext.resources).thenReturn(mockResources) in expect_exception_when_menu_has_duplicate_ids()
71 val underTest = MenuController(fakeRootProviderWithDuplicates, mockContext, mapOf()) in expect_exception_when_menu_has_duplicate_ids()
81 val underTest = MenuController(fakeRootProvider, mockContext, mapOf()) in when_opening_submenu_the_currentParent_is_updated_correctly()
93 val underTest = MenuController(fakeRootProvider, mockContext, mapOf()) in expect_exception_if_the_submenu_is_not_a_direct_child_of_the_current_parent()
106 val underTest = MenuController(fakeRootProvider, mockContext, mapOf()) in when_navigating_up_then_the_currentParent_is_updated_correctly()
119 val underTest = MenuController(fakeRootProvider, mockContext, mapOf()) in when_the_menu_is_reloaded_then_the_menu_is_updated_and_the_currentParent_preserved()
132 val underTest = MenuController(fakeRootProvider, mockContext, mapOf()) in expect_exception_when_action_is_not_supported()
145 mockContext, in when_an_additional_reducer_is_provided_the_menuController_uses_it()
/packages/modules/AdServices/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/
DDeleteUninstalledJobServiceTest.java184 final Context mockContext = mock(Context.class); in scheduleIfNeeded_killSwitchOn_dontSchedule() local
186 .when(mockContext) in scheduleIfNeeded_killSwitchOn_dontSchedule()
195 mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_killSwitchOn_dontSchedule()
212 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_sameJobInfo_dontSchedule() local
214 .when(mockContext) in scheduleIfNeeded_sameJobInfo_dontSchedule()
220 mockContext, DeleteUninstalledJobService.class)) in scheduleIfNeeded_sameJobInfo_dontSchedule()
230 mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_sameJobInfo_dontSchedule()
247 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_diffJobInfo_doesSchedule() local
249 .when(mockContext) in scheduleIfNeeded_diffJobInfo_doesSchedule()
255 mockContext, DeleteUninstalledJobService.class)) in scheduleIfNeeded_diffJobInfo_doesSchedule()
[all …]
DDeleteExpiredJobServiceTest.java201 final Context mockContext = mock(Context.class); in scheduleIfNeeded_killSwitchOn_dontSchedule() local
203 .when(mockContext) in scheduleIfNeeded_killSwitchOn_dontSchedule()
212 mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_killSwitchOn_dontSchedule()
229 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_sameJobInfoNoForceSchedule_dontSchedule() local
231 .when(mockContext) in scheduleIfNeeded_sameJobInfoNoForceSchedule_dontSchedule()
237 mockContext, DeleteExpiredJobService.class)) in scheduleIfNeeded_sameJobInfoNoForceSchedule_dontSchedule()
248 mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_sameJobInfoNoForceSchedule_dontSchedule()
265 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_diffJobInfoNoForceSchedule_dontSchedule() local
267 .when(mockContext) in scheduleIfNeeded_diffJobInfoNoForceSchedule_dontSchedule()
273 mockContext, DeleteExpiredJobService.class)) in scheduleIfNeeded_diffJobInfoNoForceSchedule_dontSchedule()
[all …]
/packages/modules/AdServices/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/
DVerboseDebugReportingJobServiceTest.java243 final Context mockContext = mock(Context.class); in scheduleIfNeeded_killSwitchOn_dontSchedule() local
245 .when(mockContext) in scheduleIfNeeded_killSwitchOn_dontSchedule()
254 mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_killSwitchOn_dontSchedule()
271 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_killSwitchOff_sameJobInfoDontForceSchedule_dontSchedule() local
273 .when(mockContext) in scheduleIfNeeded_killSwitchOff_sameJobInfoDontForceSchedule_dontSchedule()
279 mockContext, in scheduleIfNeeded_killSwitchOff_sameJobInfoDontForceSchedule_dontSchedule()
289 mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_killSwitchOff_sameJobInfoDontForceSchedule_dontSchedule()
306 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_killSwitchOff_diffJobInfoDontForceSchedule_doesSchedule() local
308 .when(mockContext) in scheduleIfNeeded_killSwitchOff_diffJobInfoDontForceSchedule_doesSchedule()
314 mockContext, in scheduleIfNeeded_killSwitchOff_diffJobInfoDontForceSchedule_doesSchedule()
[all …]
DEventFallbackReportingJobServiceTest.java251 final Context mockContext = mock(Context.class); in scheduleIfNeeded_killSwitchOn_dontSchedule() local
253 .when(mockContext) in scheduleIfNeeded_killSwitchOn_dontSchedule()
262 mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_killSwitchOn_dontSchedule()
280 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_killSwitchOff_previouslyExecuted_dontForceSchedule_dontSchedule() local
282 .when(mockContext) in scheduleIfNeeded_killSwitchOff_previouslyExecuted_dontForceSchedule_dontSchedule()
288 mockContext, in scheduleIfNeeded_killSwitchOff_previouslyExecuted_dontForceSchedule_dontSchedule()
301 mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_killSwitchOff_previouslyExecuted_dontForceSchedule_dontSchedule()
318 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_diffJobInfo_doesSchedule() local
320 .when(mockContext) in scheduleIfNeeded_diffJobInfo_doesSchedule()
327 mockContext, in scheduleIfNeeded_diffJobInfo_doesSchedule()
[all …]
DVerboseDebugReportingFallbackJobServiceTest.java251 final Context mockContext = mock(Context.class); in scheduleIfNeeded_killSwitchOn_dontSchedule() local
253 .when(mockContext) in scheduleIfNeeded_killSwitchOn_dontSchedule()
262 mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_killSwitchOn_dontSchedule()
280 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_sameJobInfoDontForceSchedule_dontSchedule() local
282 .when(mockContext) in scheduleIfNeeded_sameJobInfoDontForceSchedule_dontSchedule()
288 mockContext, in scheduleIfNeeded_sameJobInfoDontForceSchedule_dontSchedule()
300 mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_sameJobInfoDontForceSchedule_dontSchedule()
318 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_diffJobInfoDontForceSchedule_doesSchedule() local
320 .when(mockContext) in scheduleIfNeeded_diffJobInfoDontForceSchedule_doesSchedule()
326 mockContext, in scheduleIfNeeded_diffJobInfoDontForceSchedule_doesSchedule()
[all …]
/packages/providers/MediaProvider/photopicker/tests/src/com/android/photopicker/
DPhotopickerFeatureBaseTest.kt77 mockContext: Context, in setupTestForUserMonitor()
83 mockSystemService(mockContext, UserManager::class.java) { mockUserManager } in setupTestForUserMonitor()
101 whenever(mockContext.contentResolver) { contentResolver } in setupTestForUserMonitor()
102 whenever(mockContext.packageManager) { mockPackageManager } in setupTestForUserMonitor()
103 whenever(mockContext.packageName) { "com.android.photopicker" } in setupTestForUserMonitor()
107 whenever(mockContext.createContextAsUser(any(UserHandle::class.java), anyInt())) { in setupTestForUserMonitor()
108 mockContext in setupTestForUserMonitor()
111 mockContext.createPackageContextAsUser( in setupTestForUserMonitor()
117 mockContext in setupTestForUserMonitor()
DMainActivityTest.kt96 @Inject lateinit var mockContext: Context in <lambda>() variable in com.android.photopicker.MainActivityTest
109 mockSystemService(mockContext, UserManager::class.java) { mockUserManager } in <lambda>()
118 whenever(mockContext.contentResolver) { contentResolver } in <lambda>()
119 whenever(mockContext.packageManager) { mockPackageManager } in <lambda>()
120 whenever(mockContext.packageName) { "com.android.photopicker" } in <lambda>()
122 whenever(mockContext.createContextAsUser(any(UserHandle::class.java), anyInt())) { in <lambda>()
123 mockContext in <lambda>()
126 mockContext.createPackageContextAsUser( in <lambda>()
132 mockContext in <lambda>()
/packages/modules/Permission/PermissionController/tests/inprocess/src/com/android/permissioncontroller/permission/util/
DKotlinUtilsTest.kt81 val mockContext = mock(Context::class.java) in <lambda>() constant
83 whenever(mockContext.packageManager).thenReturn(mockPackageManager) in <lambda>()
101 val intent = KotlinUtils.getAppStoreIntent(mockContext, installerPackage, appPackage) in <lambda>()
114 val mockContext = mock(Context::class.java) in <lambda>() constant
116 whenever(mockContext.packageManager).thenReturn(mockPackageManager) in <lambda>()
128 val intent = KotlinUtils.getAppStoreIntent(mockContext, "com.installer", appPackage) in <lambda>()
136 val mockContext = mock(Context::class.java) in <lambda>() constant
137 whenever(mockContext.packageManager).thenReturn(mock(PackageManager::class.java)) in <lambda>()
140 assertThat(KotlinUtils.getAppStoreIntent(mockContext, "com.installer", "com.app")).isNull() in <lambda>()
/packages/providers/MediaProvider/photopicker/tests/src/com/android/photopicker/features/profileselector/
DProfileSelectorViewModelTest.kt62 @Mock lateinit var mockContext: Context variable in com.android.photopicker.features.profileselector.ProfileSelectorViewModelTest
121 mockSystemService(mockContext, UserManager::class.java) { mockUserManager } in setup()
131 whenever(mockContext.packageManager) { mockPackageManager } in setup()
132 whenever(mockContext.contentResolver) { mockContentResolver } in setup()
133 whenever(mockContext.createPackageContextAsUser(any(), anyInt(), any())) { mockContext } in setup()
134 whenever(mockContext.createContextAsUser(any(UserHandle::class.java), anyInt())) { in setup()
135 mockContext in setup()
174 mockContext, in testExposesUserProfileFlowsForUi()
222 mockContext, in testProfileSwitchClearsSelection()
241 viewModel.requestSwitchUser(requested = managedProfile, context = mockContext) in testProfileSwitchClearsSelection()
/packages/modules/AdServices/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/attribution/
DAttributionFallbackJobServiceTest.java254 final Context mockContext = mock(Context.class); in scheduleIfNeeded_killSwitchOn_dontSchedule() local
256 .when(mockContext) in scheduleIfNeeded_killSwitchOn_dontSchedule()
265 mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_killSwitchOn_dontSchedule()
282 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_sameJobInfoDontForceSchedule_dontSchedule() local
284 .when(mockContext) in scheduleIfNeeded_sameJobInfoDontForceSchedule_dontSchedule()
294 mockContext, in scheduleIfNeeded_sameJobInfoDontForceSchedule_dontSchedule()
305 mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_sameJobInfoDontForceSchedule_dontSchedule()
322 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_sameJobInfoDontForceSchedule_doesSchedule() local
324 .when(mockContext) in scheduleIfNeeded_sameJobInfoDontForceSchedule_doesSchedule()
330 mockContext, in scheduleIfNeeded_sameJobInfoDontForceSchedule_doesSchedule()
[all …]
DAttributionJobServiceTest.java424 final Context mockContext = mock(Context.class); in scheduleIfNeeded_killSwitchOn_dontSchedule() local
426 .when(mockContext) in scheduleIfNeeded_killSwitchOn_dontSchedule()
434 AttributionJobService.scheduleIfNeeded(mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_killSwitchOn_dontSchedule()
451 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_sameJobInfoDontForceSchedule_dontSchedule() local
453 .when(mockContext) in scheduleIfNeeded_sameJobInfoDontForceSchedule_dontSchedule()
459 mockContext, AttributionJobService.class)) in scheduleIfNeeded_sameJobInfoDontForceSchedule_dontSchedule()
474 AttributionJobService.scheduleIfNeeded(mockContext, /* forceSchedule= */ false); in scheduleIfNeeded_sameJobInfoDontForceSchedule_dontSchedule()
491 final Context mockContext = spy(ApplicationProvider.getApplicationContext()); in scheduleIfNeeded_diffJobInfoDontForceSchedule_doesSchedule() local
493 .when(mockContext) in scheduleIfNeeded_diffJobInfoDontForceSchedule_doesSchedule()
499 mockContext, AttributionJobService.class)) in scheduleIfNeeded_diffJobInfoDontForceSchedule_doesSchedule()
[all …]
/packages/providers/MediaProvider/photopicker/tests/src/com/android/photopicker/features/preview/
DPreviewViewModelTest.kt94 @Mock lateinit var mockContext: Context variable in com.android.photopicker.features.preview.PreviewViewModelTest
175 mockSystemService(mockContext, UserManager::class.java) { mockUserManager } in setup()
181 whenever(mockContext.getApplicationInfo()) { in setup()
184 mockContentResolver = MockContentResolver(mockContext) in setup()
189 whenever(mockContext.packageManager) { mockPackageManager } in setup()
190 whenever(mockContext.contentResolver) { mockContentResolver } in setup()
191 whenever(mockContext.createPackageContextAsUser(any(), anyInt(), any())) { mockContext } in setup()
192 whenever(mockContext.createContextAsUser(any(UserHandle::class.java), anyInt())) { in setup()
193 mockContext in setup()
232 mockContext, in testToggleInSelectionUpdatesSelection()
[all …]
/packages/modules/HealthFitness/apk/tests/src/com/android/healthconnect/controller/tests/safetycenter/
DSafetyCenterManagerWrapperTest.kt36 private val mockContext: Context = Mockito.mock(Context::class.java) constant in com.android.healthconnect.controller.tests.safetycenter.SafetyCenterManagerWrapperTest
55 whenever(mockContext.getSystemService(SafetyCenterManager::class.java)).thenReturn(null) in isEnabled_whenSystemServiceNull_returnsFalse()
56 assertThat(wrapper.isEnabled(mockContext)).isFalse() in isEnabled_whenSystemServiceNull_returnsFalse()
61 whenever(mockContext.getSystemService(SafetyCenterManager::class.java)) in setSafetySourceData_callsSafetyCenterManager()
80 mockContext, HEALTH_CONNECT_SOURCE_ID, safetySourceData, safetyEvent) in setSafetySourceData_callsSafetyCenterManager()
/packages/apps/DocumentsUI/tests/unit/com/android/documentsui/
DUserIdManagerTest.java49 private final Context mockContext = mock(Context.class); field in UserIdManagerTest
56 when(mockContext.getApplicationContext()).thenReturn(mockContext); in setUp()
63 when(mockContext.getSystemService(Context.USER_SERVICE)).thenReturn(mockUserManager); in setUp()
136 mUserIdManager = new UserIdManager.RuntimeUserIdManager(mockContext, currentUser, false); in testGetUserIds_deviceNotSupported()
145 when(mockContext.checkSelfPermission(Manifest.permission.INTERACT_ACROSS_USERS)) in testGetUserIds_deviceWithoutPermission()
150 mUserIdManager = UserIdManager.create(mockContext); in testGetUserIds_deviceWithoutPermission()
193 mUserIdManager = new UserIdManager.RuntimeUserIdManager(mockContext, current, true); in initializeUserIdManager()
/packages/apps/Settings/tests/robotests/src/com/android/settings/deviceinfo/storage/
DStorageItemPreferenceControllerTest.java189 final Context mockContext = getMockContext(); in launchImagesIntent_resolveActionViewNull_settingsIntent() local
190 mController = new StorageItemPreferenceController(mockContext, mFragment, mVolume, in launchImagesIntent_resolveActionViewNull_settingsIntent()
195 verify(mockContext).startActivityAsUser(argumentCaptor.capture(), in launchImagesIntent_resolveActionViewNull_settingsIntent()
206 final Context mockContext = getMockContext(); in launchAudioIntent_resolveActionViewNull_settingsIntent() local
207 mController = new StorageItemPreferenceController(mockContext, mFragment, mVolume, in launchAudioIntent_resolveActionViewNull_settingsIntent()
212 verify(mockContext).startActivityAsUser(argumentCaptor.capture(), in launchAudioIntent_resolveActionViewNull_settingsIntent()
288 final Context mockContext = getMockContext(); in launchDocumentsIntent_resolveActionViewNull_settingsIntent() local
289 mController = new StorageItemPreferenceController(mockContext, mFragment, mVolume, in launchDocumentsIntent_resolveActionViewNull_settingsIntent()
294 verify(mockContext).startActivityAsUser(argumentCaptor.capture(), in launchDocumentsIntent_resolveActionViewNull_settingsIntent()
305 final Context mockContext = getMockContext(); in launchOtherIntent_resolveActionViewNull_settingsIntent() local
[all …]
/packages/modules/Bluetooth/android/app/tests/unit/src/com/android/bluetooth/map/
DEventTest.java69 Context mockContext = mock(Context.class); in setUp() local
72 new BluetoothMapContentObserverTest.ExceptionTestProvider(mockContext); in setUp()
81 when(mockContext.getContentResolver()).thenReturn(mockResolver); in setUp()
82 when(mockContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mockTelephony); in setUp()
83 when(mockContext.getSystemServiceName(TelephonyManager.class)) in setUp()
85 when(mockContext.getSystemService(Context.USER_SERVICE)).thenReturn(mockUserService); in setUp()
86 mObserver = new BluetoothMapContentObserver(mockContext, null, mockMas, null, true); in setUp()

1234