/frameworks/opt/telephony/tests/telephonytests/src/com/android/internal/telephony/ |
D | TelephonyPermissionsTest.java | 69 private Context mMockContext; field in TelephonyPermissionsTest 98 when(mMockContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn( in setUp() 102 when(mMockContext.getSystemService(Context.APP_OPS_SERVICE)).thenReturn(mMockAppOps); in setUp() 103 when(mMockContext.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE)).thenReturn( in setUp() 105 when(mMockContext.getSystemService(Context.DEVICE_POLICY_SERVICE)).thenReturn( in setUp() 111 doThrow(new SecurityException()).when(mMockContext) in setUp() 113 doThrow(new SecurityException()).when(mMockContext) in setUp() 123 when(mMockContext.checkPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, in setUp() 134 mMockContext, SUB_ID, PID, UID, PACKAGE, FEATURE, MSG); in testCheckReadPhoneState_noPermissions() 143 doNothing().when(mMockContext).enforcePermission( in testCheckReadPhoneState_hasPrivilegedPermission() [all …]
|
D | SmsPermissionsTest.java | 58 private Context mMockContext; field in SmsPermissionsTest 77 mMockPhone, mMockContext, mMockAppOps) { in setUp() 113 Mockito.doThrow(new SecurityException(MESSAGE)).when(mMockContext) in testCheckCallingSendTextPermissions_persist_noGrant() 138 Mockito.doThrow(new SecurityException(MESSAGE)).when(mMockContext) in testCheckCallingSendTextPermissions_noPersist_grantViaCarrierApp() 140 Mockito.doThrow(new SecurityException(MESSAGE)).when(mMockContext) in testCheckCallingSendTextPermissions_noPersist_grantViaCarrierApp() 158 Mockito.doThrow(new SecurityException(MESSAGE)).when(mMockContext) in testCheckCallingSendTextPermissions_noPersist_noModify() 172 Mockito.doThrow(new SecurityException(MESSAGE)).when(mMockContext) in testCheckCallingSendTextPermissions_noPersist_noSendSmsPermission() 197 Mockito.when(mMockContext.checkCallingOrSelfPermission( in testCheckCallingOrSelfCanGetSmscAddressPermissions_defaultSmsApp() 205 Mockito.when(mMockContext.checkCallingOrSelfPermission( in testCheckCallingOrSelfCanGetSmscAddressPermissions_hasReadPrivilegedPhoneState() 213 Mockito.when(mMockContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn( in testCheckCallingOrSelfCanGetSmscAddressPermissions_noPermissions() [all …]
|
/frameworks/base/packages/SettingsLib/tests/robotests/src/com/android/settingslib/fuelgauge/ |
D | BatterySaverUtilsTest.java | 49 private Context mMockContext; field in BatterySaverUtilsTest 61 when(mMockContext.getContentResolver()).thenReturn(mMockResolver); in setUp() 62 when(mMockContext.getSystemService(eq(PowerManager.class))).thenReturn(mMockPowerManager); in setUp() 71 assertThat(BatterySaverUtils.setPowerSaveMode(mMockContext, true, true)).isFalse(); in testSetPowerSaveMode_enable_firstCall_needWarning() 73 verify(mMockContext, times(1)).sendBroadcast(any(Intent.class)); in testSetPowerSaveMode_enable_firstCall_needWarning() 88 assertThat(BatterySaverUtils.setPowerSaveMode(mMockContext, true, true)).isTrue(); in testSetPowerSaveMode_enable_secondCall_needWarning() 90 verify(mMockContext, times(0)).sendBroadcast(any(Intent.class)); in testSetPowerSaveMode_enable_secondCall_needWarning() 102 assertThat(BatterySaverUtils.setPowerSaveMode(mMockContext, true, true)).isTrue(); in testSetPowerSaveMode_enable_thridCall_needWarning() 104 verify(mMockContext, times(0)).sendBroadcast(any(Intent.class)); in testSetPowerSaveMode_enable_thridCall_needWarning() 116 assertThat(BatterySaverUtils.setPowerSaveMode(mMockContext, true, false)).isTrue(); in testSetPowerSaveMode_enable_firstCall_noWarning() [all …]
|
/frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/ |
D | NotificationRecordTest.java | 84 private final Context mMockContext = mock(Context.class); field in NotificationRecordTest 117 when(mMockContext.getResources()).thenReturn(getContext().getResources()); in setUp() 118 when(mMockContext.getPackageManager()).thenReturn(mPm); in setUp() 121 when(mMockContext.getApplicationInfo()).thenReturn(appInfo); in setUp() 127 final Builder builder = new Builder(mMockContext) in getNotification() 177 final Builder builder = new Builder(mMockContext) in getStyledNotification() 209 NotificationRecord record = new NotificationRecord(mMockContext, sbn, defaultChannel); in testSound_default_preUpgradeUsesNotification() 222 NotificationRecord record = new NotificationRecord(mMockContext, sbn, defaultChannel); in testSound_custom_preUpgradeUsesNotification() 236 NotificationRecord record = new NotificationRecord(mMockContext, sbn, defaultChannel); in testSound_default_userLocked_preUpgrade() 248 NotificationRecord record = new NotificationRecord(mMockContext, sbn, defaultChannel); in testSound_noSound_preUpgrade() [all …]
|
/frameworks/base/services/tests/servicestests/src/com/android/server/ |
D | NetworkScorerAppManagerTest.java | 71 @Mock private Context mMockContext; field in NetworkScorerAppManagerTest 83 when(mMockContext.getPackageManager()).thenReturn(mMockPm); in setUp() 87 when(mMockContext.getResources()).thenReturn(mResources); in setUp() 88 when(mMockContext.getSystemService(Context.APP_OPS_SERVICE)).thenReturn(mAppOpsManager); in setUp() 93 mNetworkScorerAppManager = new NetworkScorerAppManager(mMockContext, mSettingsFacade); in setUp() 253 verify(mSettingsFacade).putString(mMockContext, in testSetActiveScorer_nullPackage_currentIsSet() 255 verify(mSettingsFacade).putInt(mMockContext, in testSetActiveScorer_nullPackage_currentIsSet() 278 verify(mSettingsFacade).putString(mMockContext, in testSetActiveScorer_validPackage() 280 verify(mSettingsFacade).putInt(mMockContext, in testSetActiveScorer_validPackage() 318 verify(mSettingsFacade).putInt(mMockContext, in testUpdateState_currentPackageValid() [all …]
|
/frameworks/base/services/tests/servicestests/src/com/android/server/timedetector/ |
D | TimeDetectorServiceTest.java | 53 private Context mMockContext; field in TimeDetectorServiceTest 63 mMockContext = mock(Context.class); in setUp() 73 mMockContext, mTestHandler, mStubbedTimeDetectorStrategy); in setUp() 85 .when(mMockContext).enforceCallingPermission(anyString(), any()); in testSuggestTelephonyTime_withoutPermission() 92 verify(mMockContext).enforceCallingPermission( in testSuggestTelephonyTime_withoutPermission() 100 doNothing().when(mMockContext).enforceCallingPermission(anyString(), any()); in testSuggestTelephonyTime() 106 verify(mMockContext).enforceCallingPermission( in testSuggestTelephonyTime() 117 .when(mMockContext).enforceCallingOrSelfPermission(anyString(), any()); in testSuggestManualTime_withoutPermission() 124 verify(mMockContext).enforceCallingOrSelfPermission( in testSuggestManualTime_withoutPermission() 132 doNothing().when(mMockContext).enforceCallingOrSelfPermission(anyString(), any()); in testSuggestManualTime() [all …]
|
/frameworks/base/services/tests/servicestests/src/com/android/server/timezonedetector/ |
D | TimeZoneDetectorServiceTest.java | 49 private Context mMockContext; field in TimeZoneDetectorServiceTest 59 mMockContext = mock(Context.class); in setUp() 69 mMockContext, mTestHandler, mStubbedTimeZoneDetectorStrategy); in setUp() 81 .when(mMockContext).enforceCallingOrSelfPermission(anyString(), any()); in testSuggestManualTimeZone_withoutPermission() 88 verify(mMockContext).enforceCallingOrSelfPermission( in testSuggestManualTimeZone_withoutPermission() 96 doNothing().when(mMockContext).enforceCallingOrSelfPermission(anyString(), any()); in testSuggestManualTimeZone() 102 verify(mMockContext).enforceCallingOrSelfPermission( in testSuggestManualTimeZone() 113 .when(mMockContext).enforceCallingPermission(anyString(), any()); in testSuggestTelephonyTimeZone_withoutPermission() 120 verify(mMockContext).enforceCallingPermission( in testSuggestTelephonyTimeZone_withoutPermission() 128 doNothing().when(mMockContext).enforceCallingPermission(anyString(), any()); in testSuggestTelephonyTimeZone() [all …]
|
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/util/ |
D | WifiPermissionsUtilTest.java | 73 @Mock private Context mMockContext; field in WifiPermissionsUtilTest 141 mMockContext, mMockUserManager, mWifiInjector); in testCheckConfigOverridePermissionApproved() 155 mMockContext, mMockUserManager, mWifiInjector); in testCheckConfigOverridePermissionDenied() 169 mMockContext, mMockUserManager, mWifiInjector); in testCheckConfigOverridePermissionWithException() 194 mMockContext, mMockUserManager, mWifiInjector); in testCanReadPeersMacAddressCurrentUserAndAllPermissions() 217 mMockContext, mMockUserManager, mWifiInjector); in testCanReadPeersMacAddressCurrentProfileAndAllPermissions() 233 mMockContext, mMockUserManager, mWifiInjector); in testCannotAccessScanResult_AppNotAllowed() 261 mMockContext, mMockUserManager, mWifiInjector); in testenforceCanAccessScanResults_UserOrProfileNotCurrent() 281 mMockContext, mMockUserManager, mWifiInjector); in testCannotAccessScanResults_NoInteractAcrossUsersFullPermission() 306 mMockContext, mMockUserManager, mWifiInjector); in testLegacyForegroundAppWithOtherPermissionsDenied() [all …]
|
/frameworks/base/core/tests/coretests/src/com/android/internal/app/ |
D | ResolverListControllerTest.java | 63 @Mock private Context mMockContext; field in ResolverListControllerTest 79 when(mMockContext.getResources()).thenReturn(mMockResources); in setUp() 80 when(mMockContext.getPackageName()).thenReturn("android"); in setUp() 81 when(mMockContext.getUserId()).thenReturn(54321); in setUp() 82 when(mMockContext.getSharedPreferences(anyString(), anyInt())).thenReturn(null); in setUp() 83 when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager); in setUp() 110 when(mMockContext.getOpPackageName()).thenReturn(refererPackage); in reportChooserSelection() 111 mUsm = new UsageStatsManager(mMockContext, mMockService); in reportChooserSelection() 112 when(mMockContext.getSystemService(Context.USAGE_STATS_SERVICE)).thenReturn(mUsm); in reportChooserSelection() 113 mController = new ResolverListController(mMockContext, mMockPackageManager, sendIntent, in reportChooserSelection()
|
/frameworks/base/packages/Tethering/tests/unit/src/com/android/networkstack/tethering/ |
D | TetheringConfigurationTest.java | 70 private Context mMockContext; field in TetheringConfigurationTest 134 mMockContext = new MockContext(mContext); in setUp() 146 return new TetheringConfiguration(mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in getTetheringConfiguration() 232 mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in testNoDefinedUpstreamTypesAddsEthernet() 255 mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in testDefinedUpstreamTypesSansEthernetAddsEthernet() 273 mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in testDefinedUpstreamTypesWithEthernetDoesNotAddEthernet() 296 new TetheringConfiguration(mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in testBpfOffloadEnabledByResource() 305 new TetheringConfiguration(mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in testBpfOffloadEnabledByDeviceConfigOverride() 314 new TetheringConfiguration(mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in testBpfOffloadDisabledByResource() 323 new TetheringConfiguration(mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in testBpfOffloadDisabledByDeviceConfigOverride() [all …]
|
D | EntitlementManagerTest.java | 101 private Context mMockContext; field in EntitlementManagerTest 215 mMockContext = new MockContext(mContext); in setUp() 217 mEnMgr = new WrappedEntitlementManager(mMockContext, new Handler(mLooper.getLooper()), mLog, in setUp() 220 mConfig = new TetheringConfiguration(mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in setUp() 245 mConfig = new TetheringConfiguration(mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in setupForRequiredProvisioning() 259 mConfig = new TetheringConfiguration(mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in toleratesCarrierConfigManagerMissing() 269 mConfig = new TetheringConfiguration(mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in toleratesCarrierConfigMissing() 287 mConfig = new TetheringConfiguration(mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in provisioningNotRequiredWhenAppNotFound() 291 mConfig = new TetheringConfiguration(mMockContext, mLog, INVALID_SUBSCRIPTION_ID); in provisioningNotRequiredWhenAppNotFound()
|
/frameworks/base/core/tests/utiltests/src/com/android/internal/util/ |
D | LocationPermissionCheckerTest.java | 58 @Mock private Context mMockContext; field in LocationPermissionCheckerTest 100 when(mMockContext.getPackageManager()).thenReturn(mMockPkgMgr); in setupMocks() 114 when(mMockContext.getSystemService(Context.APP_OPS_SERVICE)) in setupMocks() 116 when(mMockContext.getSystemService(Context.USER_SERVICE)) in setupMocks() 118 when(mMockContext.getSystemService(Context.LOCATION_SERVICE)).thenReturn(mLocationManager); in setupMocks() 124 mChecker = new LocationPermissionChecker(mMockContext); in setupTestCase() 144 doAnswer(mReturnPermission).when(mMockContext).checkPermission( in setupMockInterface() 149 when(mMockContext.checkPermission(mManifestStringCoarse, -1, mUid)) in setupMockInterface() 151 when(mMockContext.checkPermission(mManifestStringFine, -1, mUid)) in setupMockInterface()
|
/frameworks/base/services/tests/mockingservicestests/src/com/android/server/ |
D | RescuePartyTest.java | 70 private Context mMockContext; field in RescuePartyTest 93 when(mMockContext.getContentResolver()).thenReturn(mMockContentResolver); in setUp() 178 verify(() -> RecoverySystem.rebootPromptAndWipeUserData(mMockContext, RescueParty.TAG)); in testBootLoopDetectionWithExecutionForAllRescueLevels() 205 verify(() -> RecoverySystem.rebootPromptAndWipeUserData(mMockContext, RescueParty.TAG)); in testPersistentAppCrashDetectionWithExecutionForAllRescueLevels() 284 verify(() -> RecoverySystem.rebootPromptAndWipeUserData(mMockContext, RescueParty.TAG)); in testIsAttemptingFactoryReset() 292 RescueParty.onSettingsProviderPublished(mMockContext); in testOnSettingsProviderPublishedExecutesRescueLevels() 305 RescueParty.onSettingsProviderPublished(mMockContext); in testNativeRescuePartyResets() 331 RescueParty.noteBoot(mMockContext); in noteBoot() 337 RescueParty.noteAppCrash(mMockContext, PERSISTENT_APP_UID); in notePersistentAppCrash()
|
/frameworks/base/services/tests/servicestests/src/com/android/server/accounts/ |
D | AccountManagerServiceTest.java | 106 @Mock private Context mMockContext; field in AccountManagerServiceTest 139 when(mMockContext.createPackageContextAsUser( in setUp() 140 anyString(), anyInt(), any(UserHandle.class))).thenReturn(mMockContext); in setUp() 141 when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager); in setUp() 149 when(mMockContext.getSystemService(Context.APP_OPS_SERVICE)).thenReturn(mMockAppOpsManager); in setUp() 150 when(mMockContext.getSystemService(Context.USER_SERVICE)).thenReturn(mMockUserManager); in setUp() 151 when(mMockContext.getSystemServiceName(AppOpsManager.class)).thenReturn( in setUp() 153 when(mMockContext.checkCallingOrSelfPermission(anyString())).thenReturn( in setUp() 157 when(mMockContext.getSystemService(Context.DEVICE_POLICY_SERVICE)).thenReturn( in setUp() 165 MyMockContext mockContext = new MyMockContext(realTestContext, mMockContext); in setUp() [all …]
|
/frameworks/base/services/tests/servicestests/src/com/android/server/accessibility/ |
D | GlobalActionPerformerTest.java | 46 @Mock Context mMockContext; field in GlobalActionPerformerTest 55 when(mMockContext.getSystemService(android.app.Service.STATUS_BAR_SERVICE)) in setup() 59 new GlobalActionPerformer(mMockContext, mMockWindowManagerInternal, in setup()
|
D | AccessibilityServiceConnectionTest.java | 67 @Mock Context mMockContext; field in AccessibilityServiceConnectionTest 91 mConnection = new AccessibilityServiceConnection(mMockUserState, mMockContext, in setup() 107 verify(mMockContext).bindServiceAsUser(any(Intent.class), eq(mConnection), in bind_requestsContextToBindService() 115 verify(mMockContext).unbindService(mConnection); in unbind_requestsContextToUnbindService()
|
/frameworks/opt/telephony/tests/telephonytests/src/android/telephony/ims/ |
D | ImsServiceTest.java | 62 private Context mMockContext; field in ImsServiceTest 68 mMockContext = mock(Context.class); in setUp() 72 mTestImsService = new TestImsService(mMockContext); in setUp() 79 mMockContext = null; in tearDown()
|
/frameworks/opt/car/services/tests/src/com/android/internal/car/ |
D | CarHelperServiceTest.java | 53 private Context mMockContext; field in CarHelperServiceTest 67 doReturn(mApplicationContext).when(mMockContext).getApplicationContext(); in setUpMocks() 69 mCarServiceHelperService = new CarServiceHelperService(mMockContext, mCarUserManagerHelper); in setUpMocks()
|
/frameworks/base/core/tests/coretests/src/android/view/contentcapture/ |
D | ContentCaptureManagerTest.java | 38 private Context mMockContext; field in ContentCaptureManagerTest 44 mManager = new ContentCaptureManager(mMockContext, /* service= */ null, in before()
|
/frameworks/base/core/tests/coretests/src/android/service/notification/ |
D | StatusBarNotificationTest.java | 50 private final Context mMockContext = mock(Context.class); field in StatusBarNotificationTest 72 when(mMockContext.getResources()).thenReturn( in setUp() 74 when(mMockContext.getPackageManager()).thenReturn(mPm); in setUp() 75 when(mMockContext.getApplicationInfo()).thenReturn(new ApplicationInfo()); in setUp() 189 final Notification.Builder builder = new Notification.Builder(mMockContext, channelId) in getNotificationBuilder()
|
/frameworks/opt/telephony/tests/telephonytests/src/com/android/internal/telephony/ims/ |
D | ImsServiceControllerTest.java | 83 @Mock Context mMockContext; field in ImsServiceControllerTest 93 mTestImsServiceController = new ImsServiceController(mMockContext, mTestComponentName, in setUp() 96 when(mMockContext.bindService(any(), any(), anyInt())).thenReturn(true); in setUp() 128 verify(mMockContext).bindService(intentCaptor.capture(), any(), eq(expectedFlags)); in testBindService() 148 verify(mMockContext, times(1)).bindService(any(), any(), anyInt()); in testBindFailureWhenBound() 308 verify(mMockContext).unbindService(eq(conn)); in testBindServiceAndConnectedDisconnectedUnbind() 338 verify(mMockContext).unbindService(eq(conn)); in testBindServiceBindUnbind() 366 verify(mMockContext).unbindService(eq(conn)); in testBindServiceAndBinderDied() 600 verify(mMockContext, times(2)).bindService(any(), any(), anyInt()); in testAutoBindAfterBinderDied() 619 verify(mMockContext, times(1)).bindService(any(), any(), anyInt()); in testNoAutoBindBeforeTimeout() [all …]
|
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/aware/ |
D | WifiAwareMetricsTest.java | 58 @Mock private Context mMockContext; field in WifiAwareMetricsTest 102 when(mMockContext.getSystemService(Context.APP_OPS_SERVICE)).thenReturn(mMockAppOpsManager); in setUp() 241 new WifiAwareClientState(mMockContext, 10, uid1, 0, null, null, null, false, in testAttachSessionMetrics() 247 new WifiAwareClientState(mMockContext, 11, uid1, 0, null, null, null, false, in testAttachSessionMetrics() 253 new WifiAwareClientState(mMockContext, 12, uid2, 0, null, null, null, false, in testAttachSessionMetrics() 259 new WifiAwareClientState(mMockContext, 13, uid2, 0, null, null, null, true, in testAttachSessionMetrics() 275 new WifiAwareClientState(mMockContext, 14, uid2, 0, null, null, null, false, in testAttachSessionMetrics() 309 WifiAwareClientState client1 = new WifiAwareClientState(mMockContext, 10, uid1, 0, null, in testDiscoverySessionMetrics() 311 WifiAwareClientState client2 = new WifiAwareClientState(mMockContext, 11, uid2, 0, null, in testDiscoverySessionMetrics() 313 WifiAwareClientState client3 = new WifiAwareClientState(mMockContext, 12, uid3, 0, null, in testDiscoverySessionMetrics()
|
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/ |
D | DpmTestBase.java | 45 protected DpmMockContext mMockContext; field in DpmTestBase 62 mMockContext = new DpmMockContext(mServices, mRealTestContext); in setUp() 77 return mMockContext; in getContext() 96 final DpmMockContext serviceContext = mMockContext; in runAsCaller()
|
/frameworks/base/tests/net/java/android/net/ |
D | VpnManagerTest.java | 54 private final MockContext mMockContext = field in VpnManagerTest 65 mVpnManager = new VpnManager(mMockContext, mMockCs); in setUp()
|
/frameworks/base/tests/net/java/com/android/server/ |
D | IpSecServiceTest.java | 118 Context mMockContext; field in IpSecServiceTest 126 mMockContext = mock(Context.class); in setUp() 130 mIpSecService = new IpSecService(mMockContext, mMockNetworkManager, mMockIpSecSrvConfig); in setUp() 138 IpSecService ipSecSrv = IpSecService.create(mMockContext, mMockNetworkManager); in testIpSecServiceCreate() 611 mMockContext, mMockNetworkManager, mMockIpSecSrvConfig, mockTagger);
|