use of com.android.contacts.common.test.mocks.MockContentProvider in project android_packages_apps_Dialer by MoKee.
the class FilteredNumberAsyncQueryHandlerTest method testBlockNumber_Disabled.
public void testBlockNumber_Disabled() throws Throwable {
if (!CompatUtils.isNCompatible()) {
return;
}
FilteredNumberCompat.setIsEnabledForTest(false);
final MockContentResolver resolver = new MockContentResolver();
MockContentProvider disabledProvider = new MockContentProvider();
resolver.addProvider(FilteredNumberContract.AUTHORITY, disabledProvider);
disabledProvider.expectInsert(BLOCKED_NUMBER_URI_M, newBlockNumberContentValuesM(), EXPECTED_URI);
final BlockNumberListener listener = new BlockNumberListener();
runTestOnUiThread(new Runnable() {
@Override
public void run() {
new FilteredNumberAsyncQueryHandler(resolver).blockNumber(listener, E164_NUMBER, NUMBER, COUNTRY_ISO);
}
});
assertSame(EXPECTED_URI, listener.waitForCallback());
disabledProvider.verify();
}
use of com.android.contacts.common.test.mocks.MockContentProvider in project android_packages_apps_Dialer by MoKee.
the class FilteredNumberAsyncQueryHandlerTest method testIsBlockedNumber_Disabled.
public void testIsBlockedNumber_Disabled() throws Throwable {
if (!CompatUtils.isNCompatible()) {
return;
}
FilteredNumberCompat.setIsEnabledForTest(false);
final MockContentResolver resolver = new MockContentResolver();
MockContentProvider disabledProvider = new MockContentProvider();
resolver.addProvider(FilteredNumberContract.AUTHORITY, disabledProvider);
disabledProvider.expectQuery(BLOCKED_NUMBER_URI_M).withProjection(FilteredNumberColumns._ID, FilteredNumberColumns.TYPE).withSelection(FilteredNumberColumns.NORMALIZED_NUMBER + " = ?", E164_NUMBER).returnRow(ID, FilteredNumberTypes.BLOCKED_NUMBER);
final CheckBlockedListener listener = new CheckBlockedListener();
runTestOnUiThread(new Runnable() {
@Override
public void run() {
new FilteredNumberAsyncQueryHandler(resolver).isBlockedNumber(listener, NUMBER, COUNTRY_ISO);
}
});
assertEquals(ID, listener.waitForCallback());
mContentProvider.verify();
}
use of com.android.contacts.common.test.mocks.MockContentProvider in project android_packages_apps_Dialer by MoKee.
the class FilteredNumberAsyncQueryHandlerTest method testUnblockNumber_Disabled.
public void testUnblockNumber_Disabled() throws Throwable {
if (!CompatUtils.isNCompatible()) {
return;
}
FilteredNumberCompat.setIsEnabledForTest(false);
final MockContentResolver resolver = new MockContentResolver();
MockContentProvider disabledProvider = new MockContentProvider();
resolver.addProvider(FilteredNumberContract.AUTHORITY, disabledProvider);
Uri uriWithId = ContentUris.withAppendedId(BLOCKED_NUMBER_URI_M, ID);
disabledProvider.expectQuery(uriWithId).withProjection(null).withDefaultProjection(FilteredNumberCompat.getIdColumnName()).withSelection(null, null).withSortOrder(null).returnRow(ID);
disabledProvider.expectDelete(uriWithId).returnRowsAffected(1);
final UnblockNumberListener listener = new UnblockNumberListener();
runTestOnUiThread(new Runnable() {
@Override
public void run() {
new FilteredNumberAsyncQueryHandler(resolver).unblock(listener, ID);
}
});
assertNotNull(listener.waitForCallback());
disabledProvider.verify();
}
use of com.android.contacts.common.test.mocks.MockContentProvider in project android_packages_apps_Dialer by MoKee.
the class FilteredNumberAsyncQueryHandlerTest method testHasBlockedNumbers_Disabled.
public void testHasBlockedNumbers_Disabled() throws Throwable {
if (!CompatUtils.isNCompatible()) {
return;
}
FilteredNumberCompat.setIsEnabledForTest(false);
final MockContentResolver resolver = new MockContentResolver();
MockContentProvider disabledProvider = new MockContentProvider();
resolver.addProvider(FilteredNumberContract.AUTHORITY, disabledProvider);
disabledProvider.expectQuery(BLOCKED_NUMBER_URI_M).withProjection(FilteredNumberColumns._ID).withSelection(FilteredNumberColumns.TYPE + "=" + FilteredNumberTypes.BLOCKED_NUMBER, null).returnRow(ID);
final HasBlockedNumbersListener listener = new HasBlockedNumbersListener();
runTestOnUiThread(new Runnable() {
@Override
public void run() {
new FilteredNumberAsyncQueryHandler(resolver).hasBlockedNumbers(listener);
}
});
assertTrue(listener.waitForCallback());
disabledProvider.verify();
}
Aggregations