use of com.android.contacts.common.test.mocks.MockAccountTypeManager in project packages_apps_Contacts by AOKP.
the class PeopleActivityTest method setUp.
@Override
public void setUp() {
mContext = new ContactsMockContext(getInstrumentation().getTargetContext());
mContactsProvider = mContext.getContactsProvider();
// The ContactsApplication performs this getType query to warm up the provider - see
// ContactsApplication#DelayedInitialization.doInBackground
mContactsProvider.expectTypeQuery(ContentUris.withAppendedId(Contacts.CONTENT_URI, 1), Contacts.CONTENT_ITEM_TYPE);
mSettingsProvider = mContext.getSettingsProvider();
InjectedServices services = new InjectedServices();
services.setContentResolver(mContext.getContentResolver());
services.setSharedPreferences(new MockSharedPreferences());
ContactPhotoManager.injectContactPhotoManagerForTesting(new MockContactPhotoManager());
AccountType accountType = new BaseAccountType() {
@Override
public boolean areContactsWritable() {
return false;
}
};
accountType.accountType = TEST_ACCOUNT_TYPE;
AccountWithDataSet account = new AccountWithDataSet(TEST_ACCOUNT, TEST_ACCOUNT_TYPE, null);
ContactsApplication.injectServices(services);
final MockAccountTypeManager mockManager = new MockAccountTypeManager(new AccountType[] { accountType }, new AccountWithDataSet[] { account });
AccountTypeManager.setInstanceForTest(mockManager);
}
use of com.android.contacts.common.test.mocks.MockAccountTypeManager in project packages_apps_Contacts by AOKP.
the class ContactEditorUtilsTest method setUp.
@Override
protected void setUp() throws Exception {
// Initialize with 0 types, 0 accounts.
mAccountTypes = new MockAccountTypeManager(new AccountType[] {}, new AccountWithDataSet[] {});
mTarget = new ContactEditorUtils(getContext(), mAccountTypes);
// Clear the preferences.
mTarget.cleanupForTest();
}
use of com.android.contacts.common.test.mocks.MockAccountTypeManager in project packages_apps_Contacts by AOKP.
the class ContactDeletionInteractionTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
// This test requires that the screen be turned on.
mUtils = new IntegrationTestUtils(getInstrumentation());
mUtils.acquireScreenWakeLock(getInstrumentation().getTargetContext());
mContext = new ContactsMockContext(getInstrumentation().getTargetContext());
InjectedServices services = new InjectedServices();
services.setContentResolver(mContext.getContentResolver());
AccountType readOnlyAccountType = new BaseAccountType() {
@Override
public boolean areContactsWritable() {
return false;
}
};
readOnlyAccountType.accountType = READONLY_ACCOUNT_TYPE;
AccountType writableAccountType = new BaseAccountType() {
@Override
public boolean areContactsWritable() {
return true;
}
};
writableAccountType.accountType = WRITABLE_ACCOUNT_TYPE;
ContactsApplication.injectServices(services);
final MockAccountTypeManager mockManager = new MockAccountTypeManager(new AccountType[] { writableAccountType, readOnlyAccountType }, null);
AccountTypeManager.setInstanceForTest(mockManager);
mContactsProvider = mContext.getContactsProvider();
}
Aggregations