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

Commit dc676e68 authored by Robin Lee's avatar Robin Lee
Browse files

Use ActivityTestRule as a Rule

Rules are rules, and the rules are that @Rule rules go through
ActivityStatement.evaluate, which among other things synchronously
finishes the activity under test even if it was manually started.

Bug: 276843259
Test: atest --iterations 100 ActivityThreadTest
Change-Id: I6fd1bb00b587250192e84bcb70771eda1259d36b
parent de95bc0b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ import androidx.test.runner.AndroidJUnit4;
import com.android.internal.content.ReferrerIntent;

import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

@@ -95,7 +96,8 @@ public class ActivityThreadTest {
    // few sequence numbers the framework used to launch the test activity.
    private static final int BASE_SEQ = 10000;

    private final ActivityTestRule<TestActivity> mActivityTestRule =
    @Rule
    public final ActivityTestRule<TestActivity> mActivityTestRule =
            new ActivityTestRule<>(TestActivity.class, true /* initialTouchMode */,
                    false /* launchActivity */);