Search in sources :

Example 1 with RenamingDelegatingContext

use of android.test.RenamingDelegatingContext in project k-9 by k9mail.

the class ReconstructMessageFromDatabaseTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    RenamingDelegatingContext context = new RenamingDelegatingContext(getContext(), "db-test-");
    setContext(context);
    BinaryTempFileBody.setTempDirectory(context.getCacheDir());
    createApplication();
    createDummyAccount(context);
}
Also used : RenamingDelegatingContext(android.test.RenamingDelegatingContext)

Example 2 with RenamingDelegatingContext

use of android.test.RenamingDelegatingContext in project standup-timer by jwood.

the class TeamTest method setUp.

@Override
protected void setUp() {
    daoFactory.setGlobalContext(new RenamingDelegatingContext(mContext, "test_"));
    daoFactory.setCacheDAOInstances(true);
    dao = daoFactory.getTeamDAO(mContext);
}
Also used : RenamingDelegatingContext(android.test.RenamingDelegatingContext)

Example 3 with RenamingDelegatingContext

use of android.test.RenamingDelegatingContext in project Etar-Calendar by Etar-Group.

the class AsyncQueryServiceTest method buildTestContext.

private Context buildTestContext(final OperationInfo[] work) {
    MockContext context = new MockContext() {

        MockContentResolver mResolver;

        @Override
        public ContentResolver getContentResolver() {
            if (mResolver == null) {
                mResolver = new MockContentResolver();
                final String filenamePrefix = "test.";
                RenamingDelegatingContext targetContextWrapper = new RenamingDelegatingContext(new MockContext2(), getContext(), filenamePrefix);
                IsolatedContext providerContext = new IsolatedContext(mResolver, targetContextWrapper);
                ContentProvider provider = new TestProvider(work);
                provider.attachInfo(providerContext, null);
                mResolver.addProvider(AUTHORITY, provider);
            }
            return mResolver;
        }

        @Override
        public String getPackageName() {
            return AsyncQueryServiceTest.class.getPackage().getName();
        }

        @Override
        public ComponentName startService(Intent service) {
            AsyncQueryServiceTest.this.startService(service);
            return service.getComponent();
        }
    };
    return context;
}
Also used : RenamingDelegatingContext(android.test.RenamingDelegatingContext) MockContext(android.test.mock.MockContext) ContentProvider(android.content.ContentProvider) Intent(android.content.Intent) MockContentResolver(android.test.mock.MockContentResolver) IsolatedContext(android.test.IsolatedContext)

Example 4 with RenamingDelegatingContext

use of android.test.RenamingDelegatingContext in project android_frameworks_base by DirtyUnicorns.

the class JobStoreTest method setUp.

@Override
public void setUp() throws Exception {
    mTestContext = new RenamingDelegatingContext(getContext(), TEST_PREFIX);
    Log.d(TAG, "Saving tasks to '" + mTestContext.getFilesDir() + "'");
    mTaskStoreUnderTest = JobStore.initAndGetForTesting(mTestContext, mTestContext.getFilesDir());
    mComponent = new ComponentName(getContext().getPackageName(), StubClass.class.getName());
}
Also used : RenamingDelegatingContext(android.test.RenamingDelegatingContext) ComponentName(android.content.ComponentName)

Example 5 with RenamingDelegatingContext

use of android.test.RenamingDelegatingContext in project android_frameworks_base by ResurrectionRemix.

the class JobStoreTest method setUp.

@Override
public void setUp() throws Exception {
    mTestContext = new RenamingDelegatingContext(getContext(), TEST_PREFIX);
    Log.d(TAG, "Saving tasks to '" + mTestContext.getFilesDir() + "'");
    mTaskStoreUnderTest = JobStore.initAndGetForTesting(mTestContext, mTestContext.getFilesDir());
    mComponent = new ComponentName(getContext().getPackageName(), StubClass.class.getName());
}
Also used : RenamingDelegatingContext(android.test.RenamingDelegatingContext) ComponentName(android.content.ComponentName)

Aggregations

RenamingDelegatingContext (android.test.RenamingDelegatingContext)18 ComponentName (android.content.ComponentName)4 Context (android.content.Context)3 Intent (android.content.Intent)3 IsolatedContext (android.test.IsolatedContext)2 MockContentResolver (android.test.mock.MockContentResolver)2 MockContext (android.test.mock.MockContext)2 GregorianCalendar (java.util.GregorianCalendar)2 MeetingDAO (net.johnpwood.android.standuptimer.dao.MeetingDAO)2 TeamDAO (net.johnpwood.android.standuptimer.dao.TeamDAO)2 Meeting (net.johnpwood.android.standuptimer.model.Meeting)2 Team (net.johnpwood.android.standuptimer.model.Team)2 ContentProvider (android.content.ContentProvider)1 TestWellSqlConfig (org.wordpress.android.TestWellSqlConfig)1 Dispatcher (org.wordpress.android.fluxc.Dispatcher)1 WellSqlConfig (org.wordpress.android.fluxc.persistence.WellSqlConfig)1 SiteStore (org.wordpress.android.fluxc.store.SiteStore)1