Home
last modified time | relevance | path

Searched refs:mMockContext (Results 1 – 25 of 36) sorted by relevance

12

/packages/providers/BlockedNumberProvider/tests/src/com/android/providers/blockednumber/
DBlockedNumberProviderTest.java61 private MyMockContext mMockContext; field in BlockedNumberProviderTest
69 mMockContext = spy(new MyMockContext(getContext())); in setUp()
70 mMockContext.initializeContext(); in setUp()
71 mResolver = mMockContext.getContentResolver(); in setUp()
73 when(mMockContext.mUserManager.isPrimaryUser()).thenReturn(true); in setUp()
74 when(mMockContext.mCountryDetector.detectCountry()) in setUp()
76 when(mMockContext.mAppOpsManager.noteOp( in setUp()
83 mMockContext.shutdown(); in tearDown()
180 verify(mMockContext.mBackupManager, times(2)).dataChanged(); in testChangesNotified()
264 when(mMockContext.mCarrierConfigManager.getConfig()) in testBlockSuppressionAfterEmergencyContact()
[all …]
DBlockedNumberContractTest.java55 private Context mMockContext; field in BlockedNumberContractTest
69 when(mMockContext.getContentResolver()).thenReturn(mMockContentResolver); in setUp()
81 assertFalse(BlockedNumberContract.isBlocked(mMockContext, TEST_NUMBER)); in testIsBlockedException()
91 assertFalse(BlockedNumberContract.canCurrentUserBlockNumbers(mMockContext)); in testCanUserBlockNumbersException()
102 BlockedNumberContract.SystemContract.shouldSystemBlockNumber(mMockContext, in testShouldSystemBlockNumberException()
114 mMockContext)); in testShouldShowEmergencyCallNotificationException()
125 mMockContext, ENHANCED_SETTING_KEY_BLOCK_PAYPHONE)); in testGetEnhancedBlockSettingException()
/packages/apps/Bluetooth/tests/unit/src/com/android/bluetooth/btservice/
DAdapterServiceTest.java77 private @Mock Context mMockContext; field in AdapterServiceTest
129 mMockContentResolver = new MockContentResolver(mMockContext); in setUp()
134 when(mMockContext.getApplicationInfo()).thenReturn(mMockApplicationInfo); in setUp()
135 when(mMockContext.getContentResolver()).thenReturn(mMockContentResolver); in setUp()
136 when(mMockContext.getApplicationContext()).thenReturn(mMockContext); in setUp()
137 when(mMockContext.createContextAsUser(UserHandle.SYSTEM, /* flags= */ 0)).thenReturn( in setUp()
138 mMockContext); in setUp()
139 when(mMockContext.getResources()).thenReturn(mMockResources); in setUp()
140 when(mMockContext.getUserId()).thenReturn(Process.BLUETOOTH_UID); in setUp()
141 when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager); in setUp()
[all …]
/packages/services/Telecomm/tests/src/com/android/server/telecom/tests/
DInCallControllerTests.java114 @Mock MockContext mMockContext; field in InCallControllerTests
156 doReturn(mMockResources).when(mMockContext).getResources(); in setUp()
164 mEmergencyCallHelper = new EmergencyCallHelper(mMockContext, mDefaultDialerCache, in setUp()
167 mInCallController = new InCallController(mMockContext, mLock, mMockCallsManager, in setUp()
170 when(mMockContext.getSystemService(eq(Context.NOTIFICATION_SERVICE))) in setUp()
217 when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager); in testBindToService_NoServicesFound_IncomingCall()
228 verify(mMockContext).bindServiceAsUser( in testBindToService_NoServicesFound_IncomingCall()
249 when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager); in testBindToService_NoServicesFound_OutgoingCall()
263 verify(mMockContext).bindServiceAsUser( in testBindToService_NoServicesFound_OutgoingCall()
287 when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager); in testBindToService_DefaultDialer_NoEmergency()
[all …]
/packages/services/Car/tests/carservice_unit_test/src/com/android/car/
DCarBluetoothServiceTest.java60 @Mock private Context mMockContext; field in CarBluetoothServiceTest
77 mMockContentResolver = new MockContentResolver(mMockContext); in setUp()
87 when(mMockContext.getResources()).thenReturn(mMockResources); in setUp()
88 when(mMockContext.getContentResolver()).thenReturn(mMockContentResolver); in setUp()
89 when(mMockContext.getApplicationContext()).thenReturn(mMockContext); in setUp()
90 when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager); in setUp()
141 mCarBluetoothService = new CarBluetoothService(mMockContext, mMockUserSwitchService); in testResourceFlagTrue_doCreateDefaultPolicy()
161 mCarBluetoothService = new CarBluetoothService(mMockContext, mMockUserSwitchService); in testResourceFlagFalse_doNotCreateDefaultPolicy()
DBluetoothDeviceConnectionPolicyTest.java56 @Mock private Context mMockContext; field in BluetoothDeviceConnectionPolicyTest
74 mMockContentResolver = new MockContentResolver(mMockContext); in setUp()
84 when(mMockContext.getResources()).thenReturn(mMockResources); in setUp()
85 when(mMockContext.getContentResolver()).thenReturn(mMockContentResolver); in setUp()
86 when(mMockContext.getApplicationContext()).thenReturn(mMockContext); in setUp()
87 when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager); in setUp()
99 }).when(mMockContext).registerReceiverAsUser(any(BroadcastReceiver.class), any(), any(), in setUp()
105 mPolicy = BluetoothDeviceConnectionPolicy.create(mMockContext, mUserId, in setUp()
120 mMockContext = null; in tearDown()
DBluetoothProfileDeviceManagerTest.java120 private MockContext mMockContext; field in BluetoothProfileDeviceManagerTest
164 mMockContext = new MockContext(InstrumentationRegistry.getTargetContext()); in setUp()
176 mProfileDeviceManager = BluetoothProfileDeviceManager.create(mMockContext, mUserId, in setUp()
197 if (mMockContext != null) { in tearDown()
198 mMockContext.release(); in tearDown()
199 mMockContext = null; in tearDown()
208 Settings.Secure.putStringForUser(mMockContext.getContentResolver(), mSettingsKey, in setSettingsDeviceList()
213 String devices = Settings.Secure.getStringForUser(mMockContext.getContentResolver(), in getSettingsDeviceList()
300 Assert.assertTrue(mMockContext != null); in sendAdapterStateChanged()
303 mMockContext.sendBroadcast(intent); in sendAdapterStateChanged()
[all …]
DLocationManagerProxyTest.java42 private Context mMockContext; field in LocationManagerProxyTest
50 when(mMockContext.getSystemService(Context.LOCATION_SERVICE)) in setUp()
52 mLocationManagerProxy = new LocationManagerProxy(mMockContext); in setUp()
/packages/apps/CellBroadcastReceiver/tests/unit/src/com/android/cellbroadcastreceiver/unit/
DCellBroadcastAlertReminderTest.java47 private Context mMockContext; field in CellBroadcastAlertReminderTest
146 doReturn(mSharedPreferences).when(mMockContext).getSharedPreferences(anyString(), anyInt()); in testQueueAlertReminderReturnFalseIfIntervalNull()
149 assertFalse(CellBroadcastAlertReminder.queueAlertReminder(mMockContext, 1, true)); in testQueueAlertReminderReturnFalseIfIntervalNull()
153 doReturn(mSharedPreferences).when(mMockContext).getSharedPreferences(anyString(), anyInt()); in testQueueAlertReminderReturnFalseIfIntervalStringNotANumber()
156 assertFalse(CellBroadcastAlertReminder.queueAlertReminder(mMockContext, 1, true)); in testQueueAlertReminderReturnFalseIfIntervalStringNotANumber()
160 doReturn(mSharedPreferences).when(mMockContext).getSharedPreferences(anyString(), anyInt()); in testQueueAlertReminderReturnFalseIfIntervalZero()
163 assertFalse(CellBroadcastAlertReminder.queueAlertReminder(mMockContext, 1, true)); in testQueueAlertReminderReturnFalseIfIntervalZero()
167 doReturn(mSharedPreferences).when(mMockContext).getSharedPreferences(anyString(), anyInt()); in testQueueAlertReminderReturnFalseIfIntervalOneButNotFirstTime()
170 assertFalse(CellBroadcastAlertReminder.queueAlertReminder(mMockContext, 1, false)); in testQueueAlertReminderReturnFalseIfIntervalOneButNotFirstTime()
/packages/modules/IPsec/tests/iketests/src/java/com/android/internal/net/eap/
DEapAkaPrimeTest.java297 new EapStateMachine(mMockContext, mEapSessionConfig, mMockSecureRandom), in setUp()
303 .when(mMockContext) in setUp()
329 verify(mMockContext).getSystemService(eq(Context.TELEPHONY_SERVICE)); in testEapAkaPrimeEndToEndExternalTestVectors()
331 mMockContext, mMockTelephonyManager, mMockSecureRandom, mMockCallback); in testEapAkaPrimeEndToEndExternalTestVectors()
410 verify(mMockContext).getSystemService(eq(Context.TELEPHONY_SERVICE)); in verifyEapAkaPrimeIdentity()
414 mMockContext, mMockTelephonyManager, mMockSecureRandom, mMockCallback); in verifyEapAkaPrimeIdentity()
448 mMockContext, mMockTelephonyManager, mMockSecureRandom, mMockCallback); in verifyEapAkaPrimeChallenge()
459 verify(mMockContext).getSystemService(eq(Context.TELEPHONY_SERVICE)); in verifyEapAkaPrimeChallengeWithoutIdentityReq()
461 mMockContext, mMockTelephonyManager, mMockSecureRandom, mMockCallback); in verifyEapAkaPrimeChallengeWithoutIdentityReq()
471 mMockContext, mMockTelephonyManager, mMockSecureRandom, mMockCallback); in verifyEapAkaPrimeSynchronizationFailure()
DEapAkaTest.java197 new EapStateMachine(mMockContext, mEapSessionConfig, mMockSecureRandom), in setUp()
203 .when(mMockContext) in setUp()
270 verify(mMockContext).getSystemService(eq(Context.TELEPHONY_SERVICE)); in verifyEapAkaIdentity()
274 mMockContext, mMockTelephonyManager, mMockSecureRandom, mMockCallback); in verifyEapAkaIdentity()
305 mMockContext, mMockTelephonyManager, mMockSecureRandom, mMockCallback); in verifyEapAkaChallenge()
316 verify(mMockContext).getSystemService(eq(Context.TELEPHONY_SERVICE)); in verifyEapAkaChallengeWithoutIdentityReq()
318 mMockContext, mMockTelephonyManager, mMockSecureRandom, mMockCallback); in verifyEapAkaChallengeWithoutIdentityReq()
328 mMockContext, mMockTelephonyManager, mMockSecureRandom, mMockCallback); in verifyEapAkaSynchronizationFailure()
DEapSimTest.java182 new EapStateMachine(mMockContext, mEapSessionConfig, mMockSecureRandom), in setUp()
238 .when(mMockContext) in verifyEapSimStart()
254 verify(mMockContext).getSystemService(eq(Context.TELEPHONY_SERVICE)); in verifyEapSimStart()
265 mMockContext, in verifyEapSimStart()
313 mMockContext, in verifyEapSimChallenge()
/packages/apps/Car/libs/car-telephony-common/tests/robotests/src/com/android/car/telephony/common/
DContactTest.java60 private Context mMockContext; field in ContactTest
82 when(mMockContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn( in setup()
87 mNullName = Contact.fromCursor(mMockContext, mMockCursor); in setup()
89 mEmptyName = Contact.fromCursor(mMockContext, mMockCursor); in setup()
91 mLetterName1 = Contact.fromCursor(mMockContext, mMockCursor); in setup()
93 mLetterName2 = Contact.fromCursor(mMockContext, mMockCursor); in setup()
95 mDigitName1 = Contact.fromCursor(mMockContext, mMockCursor); in setup()
97 mDigitName2 = Contact.fromCursor(mMockContext, mMockCursor); in setup()
99 mSpecCharName = Contact.fromCursor(mMockContext, mMockCursor); in setup()
/packages/apps/Settings/tests/robotests/src/com/android/settings/notification/
DRedactNotificationPreferenceControllerTest.java75 private Context mMockContext; field in RedactNotificationPreferenceControllerTest
89 when(featureFactory.securityFeatureProvider.getLockPatternUtils(mMockContext)) in setUp()
91 when(mMockContext.getContentResolver()).thenReturn(mContext.getContentResolver()); in setUp()
92 when(mMockContext.getSystemService(UserManager.class)).thenReturn(mUm); in setUp()
93 when(mMockContext.getSystemService(DevicePolicyManager.class)).thenReturn(mDpm); in setUp()
94 when(mMockContext.getSystemService(KeyguardManager.class)).thenReturn(mKm); in setUp()
98 mMockContext, RedactNotificationPreferenceController.KEY_LOCKSCREEN_REDACT); in setUp()
104 mWorkController = new RedactNotificationPreferenceController(mMockContext, in setUp()
130 mWorkController = new RedactNotificationPreferenceController(mMockContext, in getAvailabilityStatus_noWorkProfile()
132 mController = new RedactNotificationPreferenceController(mMockContext, in getAvailabilityStatus_noWorkProfile()
/packages/apps/ManagedProvisioning/tests/instrumentation/src/com/android/managedprovisioning/task/
DInstallPackageTaskTest.java79 @Mock private Context mMockContext; field in InstallPackageTaskTest
97 when(mMockContext.getPackageManager()).thenReturn(mPackageManager); in setUp()
98 when(mMockContext.getPackageName()).thenReturn(getContext().getPackageName()); in setUp()
104 when(mMockContext.registerReceiver(any(BroadcastReceiver.class), in setUp()
108 when(mMockContext.getSystemServiceName(eq(DevicePolicyManager.class))) in setUp()
110 when(mMockContext.getSystemService(eq(Context.DEVICE_POLICY_SERVICE))).thenReturn(mDpm); in setUp()
111 when(mMockContext.getUser()).thenReturn(Process.myUserHandle()); in setUp()
112 when(mMockContext.getUserId()).thenReturn(UserHandle.myUserId()); in setUp()
119 mTask = new InstallPackageTask(mDownloadPackageTask, mMockContext, TEST_PARAMS, mCallback, in setUp()
/packages/services/Car/tests/carservice_unit_test/src/com/android/car/user/
DCarUserServiceTest.java69 private Context mMockContext; field in CarUserServiceTest
97 doReturn(mApplicationContext).when(mMockContext).getApplicationContext(); in setUpMocks()
98 doReturn(mLocationManager).when(mMockContext).getSystemService(Context.LOCATION_SERVICE); in setUpMocks()
100 .when(mMockContext).getContentResolver(); in setUpMocks()
101 doReturn(mMockedUserManager).when(mMockContext).getSystemService(Context.USER_SERVICE); in setUpMocks()
103 mCarUserService = new CarUserService(mMockContext, mCarUserManagerHelper, in setUpMocks()
120 verify(mMockContext).registerReceiver(eq(mCarUserService), argument.capture()); in testRegistersToReceiveEvents()
133 verify(mMockContext).unregisterReceiver(mCarUserService); in testUnregistersEventReceivers()
228 mCarUserService.onReceive(mMockContext, intent); in testLastActiveUserUpdatedOnUserSwitch()
/packages/modules/IPsec/tests/iketests/src/java/com/android/internal/net/eap/statemachine/
DEapAkaPrimeTest.java51 protected Context mMockContext; field in EapAkaPrimeTest
59 mMockContext = mock(Context.class); in setUp()
65 .when(mMockContext) in setUp()
73 mMockContext, in setUp()
78 verify(mMockContext).getSystemService(eq(Context.TELEPHONY_SERVICE)); in setUp()
/packages/apps/Bluetooth/tests/unit/src/com/android/bluetooth/newavrcp/
DMediaPlayerListTest.java55 private @Mock Context mMockContext; field in MediaPlayerListTest
77 when(mMockContext.getSystemService(Context.AUDIO_SERVICE)).thenReturn(mockAudioManager); in setUp()
83 when(mMockContext.getSystemService(Context.MEDIA_SESSION_SERVICE)) in setUp()
89 when(mMockContext.registerReceiver(any(), any())).thenReturn(null); in setUp()
90 when(mMockContext.getApplicationContext()).thenReturn(mMockContext); in setUp()
91 when(mMockContext.getPackageManager()).thenReturn(mockPackageManager); in setUp()
/packages/services/Car/tests/carservice_test/src/com/android/car/
DFastPairProviderTest.java59 private Context mMockContext; field in FastPairProviderTest
66 when(mMockContext.getSystemService(Context.BLUETOOTH_SERVICE)).thenReturn( in setUp()
69 when(mMockContext.getResources()).thenReturn(mMockResources); in setUp()
85 FastPairProvider fastPairProvider = new FastPairProvider(mMockContext); in enabledViaModelIdTest()
99 FastPairProvider fastPairProvider = new FastPairProvider(mMockContext); in disabledViaModelIdTest()
/packages/apps/TV/tests/unit/src/com/android/tv/data/
DChannelImplTest.java64 private Context mMockContext; field in ChannelImplTest
124 mMockContext = Mockito.mock(Context.class); in setUp()
125 Mockito.when(mMockContext.getApplicationContext()).thenReturn(mMockContext); in setUp()
126 Mockito.when(mMockContext.getPackageName()).thenReturn(LIVE_CHANNELS_PACKAGE_NAME); in setUp()
127 Mockito.when(mMockContext.getPackageManager()).thenReturn(mockPackageManager); in setUp()
253 .that(testChannel.getAppLinkType(mMockContext)) in assertAppLinkType()
/packages/apps/Bluetooth/tests/unit/src/com/android/bluetooth/a2dpsink/
DA2dpSinkStreamHandlerTest.java49 @Mock private Context mMockContext; field in A2dpSinkStreamHandlerTest
73 when(mMockContext.getSystemService(Context.AUDIO_SERVICE)).thenReturn(mMockAudioManager); in setUp()
74 when(mMockContext.getResources()).thenReturn(mMockResources); in setUp()
80 when(mMockContext.getMainLooper()).thenReturn(mHandlerThread.getLooper()); in setUp()
81 when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager); in setUp()
84 mStreamHandler = spy(new A2dpSinkStreamHandler(mMockA2dpSink, mMockContext)); in setUp()
/packages/services/Telephony/tests/src/com/android/services/telephony/
DTestTelephonyConnection.java58 Context mMockContext; field in TestTelephonyConnection
86 mMockContext = mock(Context.class); in TestTelephonyConnection()
101 when(mMockPhone.getContext()).thenReturn(mMockContext); in TestTelephonyConnection()
103 when(mMockContext.getResources()).thenReturn(mMockResources); in TestTelephonyConnection()
/packages/services/Car/tests/carservice_test/src/com/android/car/garagemode/
DGarageModeServiceTest.java45 @Mock private Context mMockContext; field in GarageModeServiceTest
56 when(mMockContext.getContentResolver()).thenReturn(mMockContentResolver); in setUp()
57 mService = new GarageModeService(mMockContext, mMockController); in setUp()
/packages/apps/StorageManager/robotests/src/com/android/storagemanager/automatic/
DAutomaticStorageBroadcastReceiverTest.java42 @Mock private Context mMockContext; field in AutomaticStorageBroadcastReceiverTest
53 when(mMockContext.getSystemService(Context.JOB_SCHEDULER_SERVICE)).thenReturn( in testSetupJobServicesOnBoot()
57 br.onReceive(mMockContext, mMockIntent); in testSetupJobServicesOnBoot()
/packages/services/Telephony/tests/src/com/android/phone/euicc/
DEuiccUiDispatcherActivityTest.java50 @Mock private Context mMockContext; field in EuiccUiDispatcherActivityTest
60 when(mMockContext.getSystemService(Context.EUICC_SERVICE)).thenReturn(mMockEuiccManager); in setUp()
110 attachBaseContext(mMockContext); in TestEuiccUiDispatcherActivity()

12