Search in sources :

Example 1 with IntegrationTestUtils

use of com.android.contacts.common.test.IntegrationTestUtils 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();
}
Also used : InjectedServices(com.android.contacts.common.testing.InjectedServices) BaseAccountType(com.android.contacts.common.model.account.BaseAccountType) MockAccountTypeManager(com.android.contacts.common.test.mocks.MockAccountTypeManager) IntegrationTestUtils(com.android.contacts.common.test.IntegrationTestUtils) ContactsMockContext(com.android.contacts.common.test.mocks.ContactsMockContext) BaseAccountType(com.android.contacts.common.model.account.BaseAccountType) AccountType(com.android.contacts.common.model.account.AccountType)

Aggregations

AccountType (com.android.contacts.common.model.account.AccountType)1 BaseAccountType (com.android.contacts.common.model.account.BaseAccountType)1 IntegrationTestUtils (com.android.contacts.common.test.IntegrationTestUtils)1 ContactsMockContext (com.android.contacts.common.test.mocks.ContactsMockContext)1 MockAccountTypeManager (com.android.contacts.common.test.mocks.MockAccountTypeManager)1 InjectedServices (com.android.contacts.common.testing.InjectedServices)1