Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1048108f authored by Paul Westbrook's avatar Paul Westbrook
Browse files

Fix some Gmail tests

The SSLSessionCache attempts to create a directory through the context
In MockContext, this throws an UnsupportedOperationExcetion

This CL changes MockContext2 in ProviderTestCase2 to allow getDir
to be called, but the directory is named so it will be seperated from
a directory created by a regular context
parent 575c6710
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@ import android.test.mock.MockContext;
import android.test.mock.MockContentResolver;
import android.database.DatabaseUtils;

import java.io.File;

/**
 * This TestCase class provides a framework for isolated testing of a single
 * ContentProvider.  It uses a {@link android.test.mock.MockContentResolver} to
@@ -33,6 +35,13 @@ public abstract class ProviderTestCase2<T extends ContentProvider> extends Andro
        public Resources getResources() {
            return getContext().getResources();
        }

        @Override
        public File getDir(String name, int mode) {
            // name the directory so the directory will be seperated from
            // one created through the regular Context
            return getContext().getDir("mockcontext2_" + name, mode);
        }
    }

    public ProviderTestCase2(Class<T> providerClass, String providerAuthority) {