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

Commit 4a09e4c1 authored by Bryce Lee's avatar Bryce Lee Committed by Android (Google) Code Review
Browse files

Merge "Allow package local mocking for ActivityManager Unit Tests."

parents 20aa00fe 939a9a3d
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -52,12 +52,20 @@ import org.mockito.MockitoAnnotations;
 * A base class to handle common operations in activity related unit tests.
 */
public class ActivityTestsBase {
    private static boolean sOneTimeSetupDone = false;

    private final Context mContext = InstrumentationRegistry.getContext();
    private HandlerThread mHandlerThread;

    @Before
    public void setUp() throws Exception {
        if (!sOneTimeSetupDone) {
            sOneTimeSetupDone = true;

            // Allows to mock package local classes and methods
            System.setProperty("dexmaker.share_classloader", "true");
            MockitoAnnotations.initMocks(this);
        }
        mHandlerThread = new HandlerThread("ActivityTestsBaseThread");
        mHandlerThread.start();
    }