summaryrefslogtreecommitdiff
path: root/test/android/app/src/androidTest/java/android/app/NativeActivityTest.java
blob: 2affd512925bccf346a4c88571a31aee8bc11603 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package android.app;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;

import org.junit.Rule;
import org.junit.Test;
import org.junit.Assert;
import org.junit.runner.RunWith;
import android.util.Log;

@LargeTest
@RunWith(AndroidJUnit4.class)
public class NativeActivityTest {

    @Rule
    public ActivityTestRule<NativeActivity> mActivityTestRule = new ActivityTestRule<>(NativeActivity.class, false, false);

    @Test(timeout = 1200000L)
    public void runUnitTest() throws Exception {
        Log.v("UnitTestRunner", "Start the unit test");
        mActivityTestRule.launchActivity(null);
        while (TestState.running) {
            Log.v("UnitTestRunner", "Unit test is running...");
            Thread.sleep(1000L);
        }
        Log.v("UnitTestRunner", "All unit tests are finished!");
        mActivityTestRule.finishActivity();
        Assert.assertTrue("UnitTestRunner was not successfully finished", TestState.testResult);
    }
}