Home
last modified time | relevance | path

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

12

/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/controls/controller/
DControlsProviderLifecycleManagerTest.kt138 val mockContext = mock<Context>() in testNullBinding() constant
140 `when`(mockContext.bindServiceAsUser(any(), any(), anyInt(), any())).thenAnswer { in testNullBinding()
152 mockContext, in testNullBinding()
163 verify(mockContext).unbindService(serviceConnection) in testNullBinding()
283 val mockContext = mock<Context> { in testOnPackageUpdateWhileBound_unbound_thenBindAgain() constant
288 mockContext, in testOnPackageUpdateWhileBound_unbound_thenBindAgain()
298 clearInvocations(mockContext) in testOnPackageUpdateWhileBound_unbound_thenBindAgain()
303 val inOrder = inOrder(mockContext) in testOnPackageUpdateWhileBound_unbound_thenBindAgain()
304 inOrder.verify(mockContext).unbindService(any()) in testOnPackageUpdateWhileBound_unbound_thenBindAgain()
305 inOrder.verify(mockContext).bindServiceAsUser(any(), any(), anyInt(), any()) in testOnPackageUpdateWhileBound_unbound_thenBindAgain()
[all …]
/frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/
DValidateNotificationPeopleTest.java210 final Context mockContext = mock(Context.class); in testSearchContacts_workContact_queriesWorkContactProvider() local
211 when(mockContext.getUserId()).thenReturn(personalUserId); in testSearchContacts_workContact_queriesWorkContactProvider()
213 when(mockContext.getSystemService(UserManager.class)).thenReturn(mockUserManager); in testSearchContacts_workContact_queriesWorkContactProvider()
218 when(mockContext.getContentResolver()).thenReturn(mockContentResolver); in testSearchContacts_workContact_queriesWorkContactProvider()
223 PeopleRankingReconsideration.searchContacts(mockContext, lookupUri); in testSearchContacts_workContact_queriesWorkContactProvider()
241 final Context mockContext = mock(Context.class); in testSearchContacts_personalContact_queriesPersonalContactProvider() local
242 when(mockContext.getUserId()).thenReturn(personalUserId); in testSearchContacts_personalContact_queriesPersonalContactProvider()
244 when(mockContext.getSystemService(UserManager.class)).thenReturn(mockUserManager); in testSearchContacts_personalContact_queriesPersonalContactProvider()
246 when(mockContext.getContentResolver()).thenReturn(mockContentResolver); in testSearchContacts_personalContact_queriesPersonalContactProvider()
250 PeopleRankingReconsideration.searchContacts(mockContext, lookupUri); in testSearchContacts_personalContact_queriesPersonalContactProvider()
[all …]
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/broadcast/
DBroadcastSenderTest.kt42 private lateinit var mockContext: Context variable in com.android.systemui.broadcast.BroadcastSenderTest
55 broadcastSender = BroadcastSender(mockContext, wakeLockBuilder, executor) in setUp()
64 verify(mockContext).sendBroadcast(intent) in sendBroadcast_dispatchesWithWakelock()
75 verify(mockContext).sendBroadcast(intent, permission) in sendBroadcastWithPermission_dispatchesWithWakelock()
85 verify(mockContext).sendBroadcastAsUser(intent, UserHandle.ALL) in sendBroadcastAsUser_dispatchesWithWakelock()
96 verify(mockContext).sendBroadcastAsUser(intent, UserHandle.ALL, permission) in sendBroadcastAsUserWithPermission_dispatchesWithWakelock()
110 verify(mockContext).sendBroadcastAsUser(intent, UserHandle.ALL, permission, options) in sendBroadcastAsUserWithPermissionAndOptions_dispatchesWithWakelock()
122 verify(mockContext).sendBroadcastAsUser(intent, UserHandle.ALL, permission, 12) in sendBroadcastAsUserWithPermissionAndAppOp_dispatchesWithWakelock()
131 verify(mockContext).closeSystemDialogs() in sendCloseSystemDialogs_dispatchesWithWakelock()
DUserBroadcastDispatcherTest.kt68 private lateinit var mockContext: Context in capture() variable in com.android.systemui.broadcast.UserBroadcastDispatcherTest
89 mockContext, in capture()
223 mockContext, in testCreateActionReceiver_registerWithFlag()
243 verify(mockContext).registerReceiverAsUser( in testCreateActionReceiver_registerWithFlag()
251 mockContext, in testCreateActionReceiver_registerWithPermission()
272 verify(mockContext).registerReceiverAsUser( in testCreateActionReceiver_registerWithPermission()
DBroadcastDispatcherTest.kt78 private lateinit var mockContext: Context in <lambda>() variable in com.android.systemui.broadcast.BroadcastDispatcherTest
113 `when`(mockContext.mainExecutor).thenReturn(mainExecutor) in <lambda>()
116 mockContext, in <lambda>()
129 setUserMock(mockContext, user0) in <lambda>()
410 fakeIntents.forEach { receiver.onReceive(mockContext, it) } in <lambda>()
425 private fun setUserMock(mockContext: Context, user: UserHandle) { in <lambda>()
426 `when`(mockContext.user).thenReturn(user) in <lambda>()
427 `when`(mockContext.userId).thenReturn(user.identifier) in <lambda>()
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/clipboardoverlay/
DClipboardImageLoaderTest.kt41 @Mock private lateinit var mockContext: Context variable in com.android.systemui.clipboardoverlay.ClipboardImageLoaderTest
57 ClipboardImageLoader(mockContext, testDispatcher, CoroutineScope(testDispatcher)) in <lambda>()
59 whenever(mockContext.contentResolver).thenReturn(mockContentResolver) in <lambda>()
60 whenever(mockContext.resources).thenReturn(context.resources) in <lambda>()
73 ClipboardImageLoader(mockContext, testDispatcher, CoroutineScope(testDispatcher)) in <lambda>()
75 whenever(mockContext.contentResolver).thenReturn(mockContentResolver) in <lambda>()
76 whenever(mockContext.resources).thenReturn(context.resources) in <lambda>()
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/shared/clocks/
DClockRegistryTest.kt67 @Mock private lateinit var mockContext: Context variable in com.android.systemui.shared.clocks.ClockRegistryTest
154 whenever(mockContext.contentResolver).thenReturn(mockContentResolver) in setUp()
158 mockContext, in setUp()
194 pluginListener.onPluginLoaded(plugin1, mockContext, lifecycle1) in pluginRegistration_CorrectState()
195 pluginListener.onPluginLoaded(plugin2, mockContext, lifecycle2) in pluginRegistration_CorrectState()
227 pluginListener.onPluginLoaded(plugin1, mockContext, lifecycle1) in clockIdConflict_ErrorWithoutCrash_unloadDuplicate()
228 pluginListener.onPluginLoaded(plugin2, mockContext, lifecycle2) in clockIdConflict_ErrorWithoutCrash_unloadDuplicate()
260 pluginListener.onPluginLoaded(plugin1, mockContext, lifecycle1) in createCurrentClock_pluginConnected()
261 pluginListener.onPluginLoaded(plugin2, mockContext, lifecycle2) in createCurrentClock_pluginConnected()
281 pluginListener.onPluginLoaded(plugin1, mockContext, lifecycle1) in activeClockId_changeAfterPluginConnected()
[all …]
/frameworks/base/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/additionalviewcontainer/
DAdditionalSystemViewContainerTest.kt52 private lateinit var mockContext: Context variable in com.android.wm.shell.windowdecor.additionalviewcontainer.AdditionalSystemViewContainerTest
59 whenever(mockContext.getSystemService(WindowManager::class.java)) in setUp()
61 whenever(mockContext.getSystemService(Context in setUp()
70 mockContext, in testReleaseView_ViewRemoved()
/frameworks/base/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/
DMediaPlayerUnitTest.java145 MockContext mockContext = mock(MockContext.class); in getVirtualDeviceMockContext() local
146 when(mockContext.getDeviceId()).thenReturn(deviceId); in getVirtualDeviceMockContext()
147 when(mockContext.getSystemService(VirtualDeviceManager.class)).thenReturn(vdm); in getVirtualDeviceMockContext()
148 when(mockContext.getAttributionSource()).thenReturn(getContext().getAttributionSource()); in getVirtualDeviceMockContext()
149 when(mockContext.getResources()).thenReturn(getContext().getResources()); in getVirtualDeviceMockContext()
150 return mockContext; in getVirtualDeviceMockContext()
DAudioManagerUnitTest.java91 MockContext mockContext = mock(MockContext.class); in getVirtualDeviceMockContext() local
92 when(mockContext.getDeviceId()).thenReturn(deviceId); in getVirtualDeviceMockContext()
93 when(mockContext.getSystemService(VirtualDeviceManager.class)).thenReturn(vdm); in getVirtualDeviceMockContext()
94 return mockContext; in getVirtualDeviceMockContext()
DAudioRecordUnitTest.java132 MockContext mockContext = mock(MockContext.class); in getVirtualDeviceMockContext() local
133 when(mockContext.getDeviceId()).thenReturn(deviceId); in getVirtualDeviceMockContext()
134 when(mockContext.getSystemService(VirtualDeviceManager.class)).thenReturn(vdm); in getVirtualDeviceMockContext()
135 when(mockContext.getAttributionSource()).thenReturn(getContext().getAttributionSource()); in getVirtualDeviceMockContext()
136 return mockContext; in getVirtualDeviceMockContext()
DAudioTrackUnitTest.java130 MockContext mockContext = mock(MockContext.class); in getVirtualDeviceMockContext() local
131 when(mockContext.getDeviceId()).thenReturn(deviceId); in getVirtualDeviceMockContext()
132 when(mockContext.getSystemService(VirtualDeviceManager.class)).thenReturn(vdm); in getVirtualDeviceMockContext()
133 return mockContext; in getVirtualDeviceMockContext()
/frameworks/base/services/tests/displayservicetests/src/com/android/server/display/
DDisplayPowerStateTest.kt50 private val mockContext = mock<Context>() constant in com.android.server.display.DisplayPowerStateTest
59 whenever(mockColorFade.prepare(eq(mockContext), anyInt())).thenReturn(true) in setUp()
81 displayPowerState.prepareColorFade(mockContext, ColorFade.MODE_FADE) in GIVEN prepared WHEN draw runnable is called THEN colorFade is drawn()
91 displayPowerState.prepareColorFade(mockContext, ColorFade.MODE_FADE) in GIVEN prepared AND stopped WHEN draw runnable is called THEN colorFade is not drawn()
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/display/data/repository/
DDisplayMetricsRepositoryTest.kt47 private val mockContext: Context = mock() constant in com.android.systemui.display.data.repository.DisplayMetricsRepositoryTest
57 mockContext, in setUp()
60 whenever(mockContext.display).thenReturn(mockDisplay) in setUp()
/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/flags/
DFeatureFlagsClassicDebugTest.kt62 @Mock private lateinit var mockContext: Context variable in com.android.systemui.flags.FeatureFlagsClassicDebugTest
84 mockContext, in setup()
95 verify(mockContext).registerReceiver(capture(), any(), nullable(), nullable(), any()) in setup()
301 broadcastReceiver.onReceive(mockContext, null) in broadcastReceiver_IgnoresInvalidData()
302 broadcastReceiver.onReceive(mockContext, Intent()) in broadcastReceiver_IgnoresInvalidData()
303 broadcastReceiver.onReceive(mockContext, Intent("invalid action")) in broadcastReceiver_IgnoresInvalidData()
304 broadcastReceiver.onReceive(mockContext, Intent(FlagManager.ACTION_SET_FLAG)) in broadcastReceiver_IgnoresInvalidData()
319 mockContext, in intentWithId_NoValueKeyClears()
326 mockContext, in intentWithId_NoValueKeyClears()
494 broadcastReceiver.onReceive(mockContext, intent) in setByBroadcast()
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/media/controls/domain/resume/
DMediaResumeListenerTest.kt93 @Mock private lateinit var mockContext: Context in capture() variable in com.android.systemui.media.controls.domain.resume.MediaResumeListenerTest
133 whenever(mockContext.getSharedPreferences(eq(MEDIA_PREFERENCES), anyInt())) in capture()
138 whenever(mockContext.packageManager).thenReturn(context.packageManager) in capture()
139 whenever(mockContext.contentResolver).thenReturn(context.contentResolver) in capture()
140 whenever(mockContext.userId).thenReturn(context.userId) in capture()
146 mockContext, in capture()
438 mockContext, in capture()
455 resumeListener.userUnlockReceiver.onReceive(mockContext, intent) in capture()
471 mockContext, in capture()
488 resumeListener.userUnlockReceiver.onReceive(mockContext, intent) in capture()
[all …]
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/appselector/view/
DTaskPreviewSizeProviderTest.kt46 private val mockContext = mock<Context>() constant
55 whenever(mockContext.getSystemService(eq(WindowManager::class.java))) in setup()
57 whenever(mockContext.resources).thenReturn(resources) in setup()
152 mockContext, in createSizeProvider()
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/
DUiModeNightTileTest.kt55 @Mock private lateinit var mockContext: Context variable in com.android.systemui.qs.tiles.UiModeNightTileTest
80 `when`(qsHost.context).thenReturn(mockContext) in setUp()
82 `when`(mockContext.resources).thenReturn(resources) in setUp()
DFlashlightTileTest.kt34 @Mock private lateinit var mockContext: Context variable in com.android.systemui.qs.tiles.FlashlightTileTest
59 Mockito.`when`(qsHost.context).thenReturn(mockContext) in setUp()
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/qs/external/
DCustomTileStatePersisterTest.kt69 private lateinit var mockContext: Context variable in com.android.systemui.qs.external.CustomTileStatePersisterTest
83 `when`(mockContext.getSharedPreferences(anyString(), anyInt())) in setUp()
88 customTileStatePersister = CustomTileStatePersisterImpl(mockContext) in setUp()
/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/
DDisplayCutoutBaseViewTest.kt52 @Mock private lateinit var mockContext: Context variable in com.android.systemui.DisplayCutoutBaseViewTest
174 whenever(cutoutBaseView.context).thenReturn(mockContext) in setupDisplayCutoutBaseView()
175 whenever(mockContext.display).thenReturn(mockDisplay) in setupDisplayCutoutBaseView()
DScreenDecorHwcLayerTest.kt48 @Mock private lateinit var mockContext: Context variable in com.android.systemui.ScreenDecorHwcLayerTest
81 whenever(decorHwcLayer.context).thenReturn(mockContext) in setUp()
82 whenever(mockContext.display).thenReturn(mockDisplay) in setUp()
/frameworks/base/services/tests/media/mediarouterservicetest/src/com/android/server/media/
DAudioManagerRouteControllerTest.java116 Context mockContext = Mockito.mock(Context.class); in setUp() local
117 when(mockContext.getResources()).thenReturn(mockResources); in setUp()
121 when(mockContext.getApplicationInfo()).thenReturn(realContext.getApplicationInfo()); in setUp()
133 mockContext, in setUp()

12