/frameworks/opt/telephony/tests/telephonytests/src/com/android/internal/telephony/ |
D | TelephonyPermissionsTest.java | 48 private Context mMockContext; field in TelephonyPermissionsTest 57 when(mMockContext.getSystemService(Context.APP_OPS_SERVICE)).thenReturn(mMockAppOps); in setUp() 60 doThrow(new SecurityException()).when(mMockContext) in setUp() 62 doThrow(new SecurityException()).when(mMockContext) in setUp() 74 mMockContext, () -> mMockTelephony, SUB_ID, PID, UID, PACKAGE, MSG); in testCheckReadPhoneState_noPermissions() 83 doNothing().when(mMockContext).enforcePermission( in testCheckReadPhoneState_hasPrivilegedPermission() 86 mMockContext, () -> mMockTelephony, SUB_ID, PID, UID, PACKAGE, MSG)); in testCheckReadPhoneState_hasPrivilegedPermission() 91 doNothing().when(mMockContext).enforcePermission( in testCheckReadPhoneState_hasPermissionAndAppOp() 96 mMockContext, () -> mMockTelephony, SUB_ID, PID, UID, PACKAGE, MSG)); in testCheckReadPhoneState_hasPermissionAndAppOp() 101 doNothing().when(mMockContext).enforcePermission( in testCheckReadPhoneState_hasPermissionWithoutAppOp() [all …]
|
D | IccSmsInterfaceManagerTest.java | 49 private Context mMockContext; field in IccSmsInterfaceManagerTest 69 mMockPhone, mMockContext, mMockAppOps, mMockUserManager, in setUp() 99 Mockito.doThrow(new SecurityException(MESSAGE)).when(mMockContext) in testCheckCallingSendTextPermissions_persist_noGrant() 123 Mockito.doThrow(new SecurityException(MESSAGE)).when(mMockContext) in testCheckCallingSendTextPermissions_noPersist_grantViaCarrierApp() 125 Mockito.doThrow(new SecurityException(MESSAGE)).when(mMockContext) in testCheckCallingSendTextPermissions_noPersist_grantViaCarrierApp() 143 Mockito.doThrow(new SecurityException(MESSAGE)).when(mMockContext) in testCheckCallingSendTextPermissions_noPersist_noModify() 156 Mockito.doThrow(new SecurityException(MESSAGE)).when(mMockContext) in testCheckCallingSendTextPermissions_noPersist_noSendSmsPermission()
|
/frameworks/base/packages/SettingsLib/tests/robotests/src/com/android/settingslib/fuelgauge/ |
D | BatterySaverUtilsTest.java | 51 Context mMockContext; field in BatterySaverUtilsTest 63 when(mMockContext.getContentResolver()).thenReturn(mMockResolver); in setUp() 64 when(mMockContext.getSystemService(eq(PowerManager.class))).thenReturn(mMockPowerManager); in setUp() 73 assertEquals(false, BatterySaverUtils.setPowerSaveMode(mMockContext, true, true)); in testSetPowerSaveMode_enable_firstCall_needWarning() 75 verify(mMockContext, times(1)).sendBroadcast(any(Intent.class)); in testSetPowerSaveMode_enable_firstCall_needWarning() 90 assertEquals(true, BatterySaverUtils.setPowerSaveMode(mMockContext, true, true)); in testSetPowerSaveMode_enable_secondCall_needWarning() 92 verify(mMockContext, times(0)).sendBroadcast(any(Intent.class)); in testSetPowerSaveMode_enable_secondCall_needWarning() 104 assertEquals(true, BatterySaverUtils.setPowerSaveMode(mMockContext, true, true)); in testSetPowerSaveMode_enable_thridCall_needWarning() 106 verify(mMockContext, times(0)).sendBroadcast(any(Intent.class)); in testSetPowerSaveMode_enable_thridCall_needWarning() 118 assertEquals(true, BatterySaverUtils.setPowerSaveMode(mMockContext, true, false)); in testSetPowerSaveMode_enable_firstCall_noWarning() [all …]
|
/frameworks/base/services/tests/servicestests/src/com/android/server/ |
D | NetworkScorerAppManagerTest.java | 72 @Mock private Context mMockContext; field in NetworkScorerAppManagerTest 84 when(mMockContext.getPackageManager()).thenReturn(mMockPm); in setUp() 88 when(mMockContext.getResources()).thenReturn(mResources); in setUp() 89 when(mMockContext.getSystemService(Context.APP_OPS_SERVICE)).thenReturn(mAppOpsManager); in setUp() 94 mNetworkScorerAppManager = new NetworkScorerAppManager(mMockContext, mSettingsFacade); in setUp() 254 verify(mSettingsFacade).putString(mMockContext, in testSetActiveScorer_nullPackage_currentIsSet() 256 verify(mSettingsFacade).putInt(mMockContext, in testSetActiveScorer_nullPackage_currentIsSet() 279 verify(mSettingsFacade).putString(mMockContext, in testSetActiveScorer_validPackage() 281 verify(mSettingsFacade).putInt(mMockContext, in testSetActiveScorer_validPackage() 319 verify(mSettingsFacade).putInt(mMockContext, in testUpdateState_currentPackageValid() [all …]
|
/frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/ |
D | NotificationRecordTest.java | 79 private final Context mMockContext = mock(Context.class); field in NotificationRecordTest 123 when(mMockContext.getResources()).thenReturn(getContext().getResources()); in setUp() 124 when(mMockContext.getPackageManager()).thenReturn(mPm); in setUp() 125 when(mMockContext.getApplicationInfo()).thenReturn(new ApplicationInfo()); in setUp() 131 final Builder builder = new Builder(mMockContext) in getNotification() 191 NotificationRecord record = new NotificationRecord(mMockContext, sbn, defaultChannel); in testSound_default_preUpgradeUsesNotification() 204 NotificationRecord record = new NotificationRecord(mMockContext, sbn, defaultChannel); in testSound_custom_preUpgradeUsesNotification() 218 NotificationRecord record = new NotificationRecord(mMockContext, sbn, defaultChannel); in testSound_default_userLocked_preUpgrade() 230 NotificationRecord record = new NotificationRecord(mMockContext, sbn, defaultChannel); in testSound_noSound_preUpgrade() 243 NotificationRecord record = new NotificationRecord(mMockContext, sbn, channel); in testSound_default_upgradeUsesChannel() [all …]
|
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/util/ |
D | WifiPermissionsUtilTest.java | 68 @Mock private Context mMockContext; field in WifiPermissionsUtilTest 125 mMockContext, mMockWifiSettingsStore, mMockUserManager, mWifiInjector); in testCheckConfigOverridePermissionApproved() 139 mMockContext, mMockWifiSettingsStore, mMockUserManager, mWifiInjector); in testCheckConfigOverridePermissionDenied() 153 mMockContext, mMockWifiSettingsStore, mMockUserManager, mWifiInjector); in testCheckConfigOverridePermissionWithException() 178 mMockContext, mMockWifiSettingsStore, mMockUserManager, mWifiInjector); in testCanReadPeersMacAddressCurrentUserAndAllPermissions() 201 mMockContext, mMockWifiSettingsStore, mMockUserManager, mWifiInjector); in testCanReadPeersMacAddressCurrentProfileAndAllPermissions() 217 mMockContext, mMockWifiSettingsStore, mMockUserManager, mWifiInjector); in testCannotAccessScanResult_AppNotAllowed() 245 mMockContext, mMockWifiSettingsStore, mMockUserManager, mWifiInjector); in testenforceCanAccessScanResults_UserOrProfileNotCurrent() 265 mMockContext, mMockWifiSettingsStore, mMockUserManager, mWifiInjector); in testCannotAccessScanResults_NoInteractAcrossUsersFullPermission() 290 mMockContext, mMockWifiSettingsStore, mMockUserManager, mWifiInjector); in testLegacyForegroundAppWithOtherPermissionsDenied() [all …]
|
/frameworks/support/work/workmanager/src/androidTest/java/androidx/work/impl/constraints/trackers/ |
D | StorageNotLowTrackerTest.java | 47 private Context mMockContext; field in StorageNotLowTrackerTest 51 mMockContext = mock(Context.class); in setUp() 52 when(mMockContext.getApplicationContext()).thenReturn(mMockContext); in setUp() 54 mTracker = new StorageNotLowTracker(mMockContext); in setUp() 59 when(mMockContext.registerReceiver((BroadcastReceiver) isNull(), in mockContextReturns() 100 mTracker.onBroadcastReceive(mMockContext, new Intent("INVALID")); in testOnBroadcastReceive_invalidIntentAction_doesNotNotifyListeners() 111 mTracker.onBroadcastReceive(mMockContext, new Intent(Intent.ACTION_DEVICE_STORAGE_OK)); in testOnBroadcastReceive_notifiesListeners() 113 mTracker.onBroadcastReceive(mMockContext, new Intent(Intent.ACTION_DEVICE_STORAGE_LOW)); in testOnBroadcastReceive_notifiesListeners()
|
D | NetworkStateTrackerTest.java | 46 private Context mMockContext; field in NetworkStateTrackerTest 51 mMockContext = mock(Context.class); in setUp() 53 when(mMockContext.getApplicationContext()).thenReturn(mMockContext); in setUp() 54 when(mMockContext.getSystemService(eq(Context.CONNECTIVITY_SERVICE))) in setUp() 57 mTracker = new NetworkStateTracker(mMockContext); in setUp() 92 verify(mMockContext).registerReceiver(any(BroadcastReceiver.class), argCaptor.capture()); in testStartTracking_beforeApi24() 113 verify(mMockContext).unregisterReceiver(any(BroadcastReceiver.class)); in testStopTracking_beforeApi24()
|
D | BatteryChargingTrackerTest.java | 54 private Context mMockContext; field in BatteryChargingTrackerTest 58 mMockContext = mock(Context.class); in setUp() 59 when(mMockContext.getApplicationContext()).thenReturn(mMockContext); in setUp() 61 mTracker = new BatteryChargingTracker(mMockContext); in setUp() 66 when(mMockContext.registerReceiver((BroadcastReceiver) isNull(), in mockContextReturns() 156 mTracker.onBroadcastReceive(mMockContext, createChargingIntent(true)); in testOnBroadcastReceive_notifiesListeners_beforeApi23() 158 mTracker.onBroadcastReceive(mMockContext, createChargingIntent(false)); in testOnBroadcastReceive_notifiesListeners_beforeApi23() 170 mTracker.onBroadcastReceive(mMockContext, createChargingIntent_afterApi23(true)); in testOnBroadcastReceive_notifiesListeners_afterApi23() 172 mTracker.onBroadcastReceive(mMockContext, createChargingIntent_afterApi23(false)); in testOnBroadcastReceive_notifiesListeners_afterApi23()
|
D | BatteryNotLowTrackerTest.java | 55 private Context mMockContext; field in BatteryNotLowTrackerTest 61 mMockContext = mock(Context.class); in setUp() 62 when(mMockContext.getApplicationContext()).thenReturn(mMockContext); in setUp() 64 mTracker = new BatteryNotLowTracker(mMockContext); in setUp() 69 when(mMockContext.registerReceiver((BroadcastReceiver) isNull(), in mockContextReturns() 163 mTracker.onBroadcastReceive(mMockContext, new Intent("INVALID")); in testOnBroadcastReceive_invalidIntentAction_doesNotNotifyListeners() 175 mTracker.onBroadcastReceive(mMockContext, new Intent(Intent.ACTION_BATTERY_OKAY)); in testOnBroadcastReceive_notifiesListeners() 177 mTracker.onBroadcastReceive(mMockContext, new Intent(Intent.ACTION_BATTERY_LOW)); in testOnBroadcastReceive_notifiesListeners()
|
D | ConstraintTrackerTest.java | 41 private Context mMockContext; field in ConstraintTrackerTest 45 mMockContext = mock(Context.class); in setUp() 46 when(mMockContext.getApplicationContext()).thenReturn(mMockContext); in setUp() 47 mTracker = new TestConstraintTracker(mMockContext); in setUp()
|
/frameworks/base/core/tests/coretests/src/com/android/internal/app/ |
D | ResolverListControllerTest.java | 66 @Mock private Context mMockContext; field in ResolverListControllerTest 82 when(mMockContext.getResources()).thenReturn(mMockResources); in setUp() 83 when(mMockContext.getPackageName()).thenReturn("android"); in setUp() 84 when(mMockContext.getUserId()).thenReturn(54321); in setUp() 85 when(mMockContext.getSharedPreferences(anyString(), anyInt())).thenReturn(null); in setUp() 86 when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager); in setUp() 113 when(mMockContext.getOpPackageName()).thenReturn(refererPackage); in reportChooserSelection() 114 mUsm = new UsageStatsManager(mMockContext, mMockService); in reportChooserSelection() 115 when(mMockContext.getSystemService(Context.USAGE_STATS_SERVICE)).thenReturn(mUsm); in reportChooserSelection() 116 mController = new ResolverListController(mMockContext, mMockPackageManager, sendIntent, in reportChooserSelection()
|
/frameworks/base/tests/net/java/com/android/server/connectivity/tethering/ |
D | TetheringConfigurationTest.java | 58 private Context mMockContext; field in TetheringConfigurationTest 89 mMockContext = new MockContext(mContext); in setUp() 99 final TetheringConfiguration cfg = new TetheringConfiguration(mMockContext, mLog); in testDunFromTelephonyManagerMeansDun() 115 final TetheringConfiguration cfg = new TetheringConfiguration(mMockContext, mLog); in testDunNotRequiredFromTelephonyManagerMeansNoDun() 131 final TetheringConfiguration cfg = new TetheringConfiguration(mMockContext, mLog); in testDunFromUpstreamConfigMeansDun() 148 final TetheringConfiguration cfg = new TetheringConfiguration(mMockContext, mLog); in testNoDefinedUpstreamTypesAddsEthernet() 169 final TetheringConfiguration cfg = new TetheringConfiguration(mMockContext, mLog); in testDefinedUpstreamTypesSansEthernetAddsEthernet() 187 final TetheringConfiguration cfg = new TetheringConfiguration(mMockContext, mLog); in testDefinedUpstreamTypesWithEthernetDoesNotAddEthernet()
|
/frameworks/opt/telephony/tests/telephonytests/src/android/telephony/ims/ |
D | ImsServiceTest.java | 62 private Context mMockContext; field in ImsServiceTest 67 mMockContext = mock(Context.class); in setUp() 69 mTestImsService = new TestImsService(mMockContext); in setUp() 76 mMockContext = null; in tearDown() 139 verify(mMockContext).sendBroadcast(intentCaptor.capture()); in testImsServiceUpSentCompat() 161 verify(mMockContext).sendBroadcast(intentCaptor.capture()); in testImsServiceDownSentCompatInitializing()
|
/frameworks/base/services/tests/servicestests/src/com/android/server/accessibility/ |
D | GlobalActionPerformerTest.java | 44 @Mock Context mMockContext; field in GlobalActionPerformerTest 53 when(mMockContext.getSystemService(android.app.Service.STATUS_BAR_SERVICE)) in setup() 57 new GlobalActionPerformer(mMockContext, mMockWindowManagerInternal, in setup()
|
D | AccessibilityServiceConnectionTest.java | 65 @Mock Context mMockContext; field in AccessibilityServiceConnectionTest 95 mConnection = new AccessibilityServiceConnection(mMockUserState, mMockContext, in setup() 104 verify(mMockContext).bindServiceAsUser(any(Intent.class), eq(mConnection), in bind_requestsContextToBindService() 112 verify(mMockContext).unbindService(mConnection); in unbind_requestsContextToUnbindService()
|
D | UiAutomationManagerTest.java | 58 @Mock Context mMockContext; field in UiAutomationManagerTest 168 mMockAccessibilityServiceClient, mMockContext, mMockServiceInfo, SERVICE_ID, in register()
|
D | MagnificationControllerTest.java | 81 final Context mMockContext = mock(Context.class); field in MagnificationControllerTest 109 when(mMockContext.getMainLooper()).thenReturn(Looper.myLooper()); in setUp() 111 when(mMockContext.getResources()).thenReturn(mockResources); in setUp() 115 mMagnificationController = new MagnificationController(mMockContext, mMockAms, new Object(), in setUp() 139 verify(mMockContext).registerReceiver( in testRegister_WindowManagerAndContextRegisterListeners() 150 verify(mMockContext).unregisterReceiver((BroadcastReceiver) anyObject()); in testRegister_WindowManagerAndContextUnregisterListeners() 489 verify(mMockContext).registerReceiver( 493 br.onReceive(mMockContext, null);
|
/frameworks/base/services/tests/servicestests/src/com/android/server/accounts/ |
D | AccountManagerServiceTest.java | 108 @Mock private Context mMockContext; field in AccountManagerServiceTest 140 when(mMockContext.createPackageContextAsUser( in setUp() 141 anyString(), anyInt(), any(UserHandle.class))).thenReturn(mMockContext); in setUp() 142 when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager); in setUp() 150 when(mMockContext.getSystemService(Context.APP_OPS_SERVICE)).thenReturn(mMockAppOpsManager); in setUp() 151 when(mMockContext.getSystemService(Context.USER_SERVICE)).thenReturn(mMockUserManager); in setUp() 152 when(mMockContext.getSystemServiceName(AppOpsManager.class)).thenReturn( in setUp() 154 when(mMockContext.checkCallingOrSelfPermission(anyString())).thenReturn( in setUp() 158 when(mMockContext.getSystemService(Context.DEVICE_POLICY_SERVICE)).thenReturn( in setUp() 163 MyMockContext mockContext = new MyMockContext(realTestContext, mMockContext); in setUp() [all …]
|
/frameworks/opt/telephony/tests/telephonytests/src/com/android/internal/telephony/ims/ |
D | ImsServiceControllerTest.java | 80 @Mock Context mMockContext; field in ImsServiceControllerTest 90 mTestImsServiceController = new ImsServiceController(mMockContext, mTestComponentName, in setUp() 93 when(mMockContext.bindService(any(), any(), anyInt())).thenReturn(true); in setUp() 122 verify(mMockContext).bindService(intentCaptor.capture(), any(), eq(expectedFlags)); in testBindService() 142 verify(mMockContext, times(1)).bindService(any(), any(), anyInt()); in testBindFailureWhenBound() 274 verify(mMockContext).unbindService(eq(conn)); in testBindServiceBindUnbind() 452 verify(mMockContext, times(2)).bindService(any(), any(), anyInt()); in testAutoBindAfterBinderDied() 471 verify(mMockContext, times(1)).bindService(any(), any(), anyInt()); in testNoAutoBindBeforeTimeout() 494 verify(mMockContext, times(1)).bindService(any(), any(), anyInt()); in testUnbindCauseAutoBindCancelAfterBinderDied() 516 verify(mMockContext, times(2)).bindService(any(), any(), anyInt()); in testBindCauseAutoBindCancelAfterBinderDied() [all …]
|
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/aware/ |
D | WifiAwareMetricsTest.java | 54 @Mock private Context mMockContext; field in WifiAwareMetricsTest 97 when(mMockContext.getSystemService(Context.APP_OPS_SERVICE)).thenReturn(mMockAppOpsManager); in setUp() 236 new WifiAwareClientState(mMockContext, 10, uid1, 0, null, null, null, false, in testAttachSessionMetrics() 242 new WifiAwareClientState(mMockContext, 11, uid1, 0, null, null, null, false, in testAttachSessionMetrics() 248 new WifiAwareClientState(mMockContext, 12, uid2, 0, null, null, null, false, in testAttachSessionMetrics() 254 new WifiAwareClientState(mMockContext, 13, uid2, 0, null, null, null, true, in testAttachSessionMetrics() 270 new WifiAwareClientState(mMockContext, 14, uid2, 0, null, null, null, false, in testAttachSessionMetrics() 304 WifiAwareClientState client1 = new WifiAwareClientState(mMockContext, 10, uid1, 0, null, in testDiscoverySessionMetrics() 306 WifiAwareClientState client2 = new WifiAwareClientState(mMockContext, 11, uid2, 0, null, in testDiscoverySessionMetrics() 308 WifiAwareClientState client3 = new WifiAwareClientState(mMockContext, 12, uid3, 0, null, in testDiscoverySessionMetrics()
|
/frameworks/support/work/workmanager/src/androidTest/java/androidx/work/impl/utils/ |
D | IdGeneratorTest.java | 53 Context mMockContext = mock(Context.class); in setUp() local 56 when(mMockContext.getSharedPreferences( in setUp() 59 mIdGenerator = new IdGenerator(mMockContext); in setUp()
|
/frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/ |
D | DpmTestBase.java | 45 protected DpmMockContext mMockContext; field in DpmTestBase 61 mMockContext = new DpmMockContext(mServices, mRealTestContext); in setUp() 74 return mMockContext; in getContext() 93 final DpmMockContext serviceContext = mMockContext; in runAsCaller()
|
/frameworks/base/tests/net/java/com/android/server/ |
D | IpSecServiceTest.java | 116 Context mMockContext; field in IpSecServiceTest 123 mMockContext = mock(Context.class); in setUp() 126 mIpSecService = new IpSecService(mMockContext, mMockIpSecSrvConfig); in setUp() 134 IpSecService ipSecSrv = IpSecService.create(mMockContext); in testIpSecServiceCreate() 599 new IpSecService(mMockContext, mMockIpSecSrvConfig, mockTagger);
|
D | IpSecServiceRefcountedResourceTest.java | 54 Context mMockContext; field in IpSecServiceRefcountedResourceTest 60 mMockContext = mock(Context.class); in setUp() 62 mIpSecService = new IpSecService(mMockContext, mMockIpSecSrvConfig); in setUp()
|