Home
last modified time | relevance | path

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

/packages/apps/ManagedProvisioning/tests/instrumentation/src/com/android/managedprovisioning/common/
DUtilsTest.java73 @Mock private Context mockContext; field in UtilsTest
88 when(mockContext.getSystemService(Context.ACCOUNT_SERVICE)).thenReturn(mockAccountManager); in setUp()
89 when(mockContext.getPackageManager()).thenReturn(mockPackageManager); in setUp()
90 when(mockContext.getSystemService(Context.CONNECTIVITY_SERVICE)) in setUp()
135 assertTrue(mUtils.packageRequiresUpdate(TEST_PACKAGE_NAME_1, 0, mockContext)); in testPackageRequiresUpdate_notPresent()
147 assertFalse(mUtils.packageRequiresUpdate(TEST_PACKAGE_NAME_1, 0, mockContext)); in testPackageRequiresUpdate()
148 assertFalse(mUtils.packageRequiresUpdate(TEST_PACKAGE_NAME_1, 1, mockContext)); in testPackageRequiresUpdate()
149 assertTrue(mUtils.packageRequiresUpdate(TEST_PACKAGE_NAME_1, 2, mockContext)); in testPackageRequiresUpdate()
157 assertTrue(mUtils.isConnectedToNetwork(mockContext)); in testIsConnectedToNetwork()
163 assertTrue(mUtils.isConnectedToNetwork(mockContext)); in testIsConnectedToNetwork()
[all …]
DMdmPackageInfoTest.java39 @Mock private Context mockContext; field in MdmPackageInfoTest
51 when(mockContext.getPackageManager()).thenReturn(mockPackageManager); in setUp()
70 MdmPackageInfo mdmInfo = MdmPackageInfo.createFromPackageName(mockContext, in testCreateFromPackageName()
83 assertNull(MdmPackageInfo.createFromPackageName(mockContext, TEST_PACKAGE_NAME)); in testCreateFromPackageName_NameNotFoundException()
/packages/apps/Bluetooth/tests/src/com/android/bluetooth/avrcp/
DAvrcpTest.java41 Context mockContext = mock(Context.class); in testFailedBrowseStart() local
47 when(mockContext.getSystemService(Context.AUDIO_SERVICE)).thenReturn(mockAudioManager); in testFailedBrowseStart()
49 when(mockContext.getApplicationContext()).thenReturn(mockContext); in testFailedBrowseStart()
50 when(mockContext.getPackageManager()).thenReturn(mockPackageManager); in testFailedBrowseStart()
67 when(mockContext.startService(isA(Intent.class))).thenThrow(new SecurityException("test")); in testFailedBrowseStart()
72 Avrcp a = Avrcp.make(mockContext); in testFailedBrowseStart()
/packages/apps/Bluetooth/tests/src/com/android/bluetooth/map/
DBluetoothMapContentObserverTest.java40 Context mockContext = mock(Context.class); in testInitMsgList() local
42 ExceptionTestProvider mockProvider = new ExceptionTestProvider(mockContext); in testInitMsgList()
51 when(mockContext.getContentResolver()).thenReturn(mockResolver); in testInitMsgList()
52 when(mockContext.getSystemService(Context.TELEPHONY_SERVICE)) in testInitMsgList()
54 when(mockContext.getSystemService(Context.USER_SERVICE)) in testInitMsgList()
60 observer = new BluetoothMapContentObserver(mockContext, null, in testInitMsgList()
/packages/apps/Settings/tests/robotests/src/com/android/settings/applications/
DDefaultAppSettingsTest.java150 final Context mockContext = mock(Context.class); in testNonIndexableKeys_existInXmlLayout() local
151 when(mockContext.getApplicationContext()).thenReturn(mockContext); in testNonIndexableKeys_existInXmlLayout()
154 when(mockContext.getSystemService(Context.USER_SERVICE)) in testNonIndexableKeys_existInXmlLayout()
158 when(mockContext.getSystemService(Context.TELEPHONY_SERVICE)) in testNonIndexableKeys_existInXmlLayout()
160 when(mockContext.getPackageManager()) in testNonIndexableKeys_existInXmlLayout()
163 .getNonIndexableKeys(mockContext); in testNonIndexableKeys_existInXmlLayout()
/packages/apps/ManagedProvisioning/tests/instrumentation/src/com/android/managedprovisioning/task/
DDisallowAddUserTaskTest.java43 @Mock private Context mockContext; field in DisallowAddUserTaskTest
63 when(mockContext.getSystemService(Context.USER_SERVICE)).thenReturn(mockUserManager); in setUp()
75 new DisallowAddUserTask(false, mockContext, null, mCallback); in testMaybeDisallowAddUsers_normalSystem()
92 new DisallowAddUserTask(false, mockContext, null, mCallback); in testMaybeDisallowAddUsers_normalSystem_restrictionAlreadySetupForOneUser()
114 new DisallowAddUserTask(true, mockContext, null, mCallback); in testMaybeDisallowAddUsers_splitUserSystem_meatUserDeviceOwner()
132 new DisallowAddUserTask(true, mockContext, null, mCallback); in testMaybeDisallowAddUsers_splitUserSystem_systemDeviceOwner()
/packages/apps/Settings/tests/robotests/src/com/android/settings/dream/
DDreamSettingsTest.java95 Context mockContext = mock(Context.class); in summaryText_whenDreamsAreOff() local
98 assertThat(DreamSettings.getSummaryTextFromBackend(mockBackend, mockContext)) in summaryText_whenDreamsAreOff()
99 .isEqualTo(mockContext.getString(R.string.screensaver_settings_summary_off)); in summaryText_whenDreamsAreOff()
106 Context mockContext = mock(Context.class); in summaryTest_WhenDreamsAreOn() local
110 assertThat(DreamSettings.getSummaryTextFromBackend(mockBackend, mockContext)) in summaryTest_WhenDreamsAreOn()
/packages/apps/Bluetooth/tests/src/com/android/bluetooth/a2dpsink/
DA2dpSinkStreamHandlerTest.java51 @Mock Context mockContext; field in A2dpSinkStreamHandlerTest
71 when(mockContext.getSystemService(Context.AUDIO_SERVICE)).thenReturn(mockAudioManager); in setUp()
72 when(mockContext.getResources()).thenReturn(mockResources); in setUp()
79 when(mockContext.getMainLooper()).thenReturn(mHandlerThread.getLooper()); in setUp()
81 streamHandler = spy(new A2dpSinkStreamHandler(mockA2dpSink, mockContext)); in setUp()
/packages/apps/ManagedProvisioning/tests/instrumentation/src/com/android/managedprovisioning/analytics/
DAnalyticsUtilsTest.java53 @Mock private Context mockContext; field in AnalyticsUtilsTest
63 when(mockContext.getPackageManager()).thenReturn(mockPackageManager); in setUp()
71 assertNull(AnalyticsUtils.getInstallerPackageName(mockContext, INVALID_PACKAGE_NAME)); in testGetInstallerPackageName_invalidPackage()
80 AnalyticsUtils.getInstallerPackageName(mockContext, VALID_PACKAGE_NAME)); in testGetInstallerPackageName_validPackage()
/packages/apps/Settings/tests/robotests/src/com/android/settings/fuelgauge/
DBatteryEntryTest.java59 @Mock private Context mockContext; field in BatteryEntryTest
66 when(mockContext.getPackageManager()).thenReturn(mockPackageManager); in stubContextToReturnMockPackageManager()
81 return new BatteryEntry(mockContext, mockHandler, mockUserManager, createSipperForApp()); in createBatteryEntryForApp()
92 return new BatteryEntry(mockContext, mockHandler, mockUserManager, createSipperForSystem()); in createBatteryEntryForSystem()
/packages/apps/Settings/tests/robotests/src/com/android/settings/applications/instantapps/
DInstantAppButtonsControllerTest.java76 Context mockContext; field in InstantAppButtonsControllerTest
114 when(mockContext.getPackageManager()).thenReturn(mockPackageManager); in init()
117 mockContext, testFragment, mockView, mockShowDialogDelegate); in init()
121 FakeFeatureFactory.setupForTest(mockContext); in init()
/packages/services/Car/tests/carservice_unit_test/src/com/android/car/
DBluetoothAutoConnectPolicyTest.java69 private Context mockContext; field in BluetoothAutoConnectPolicyTest
219 mockContext = mock(Context.class); in makeMockServices()
282 mBluetoothDeviceConnectionPolicyTest = BluetoothDeviceConnectionPolicy.create(mockContext, in createAndSetupBluetoothPolicy()
/packages/providers/ContactsProvider/tests/src/com/android/providers/contacts/enterprise/
DEnterprisePolicyGuardTest.java272 Context mockContext = new TestMockContext(getContext(), mockDpm, mockUm); in getMockContext() local
274 return mockContext; in getMockContext()
/packages/apps/Email/tests/src/com/android/email/
DSecurityPolicyTests.java82 public MockContext2(Context mockContext, Context realContext) { in MockContext2() argument
83 super(mockContext); in MockContext2()
/packages/apps/Email/tests/src/com/android/email/provider/
DProviderTests.java92 public MockContext2(Context mockContext, Context realContext) { in MockContext2() argument
93 super(mockContext); in MockContext2()