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

Commit dd30d56c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Convert InternalStorageUiTest to Junit 4" into main

parents 1017e6aa c40cc07c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -53,7 +53,9 @@ abstract class ActivityTestJunit4<T : Activity?> {

    @JvmField
    var context: Context? = null
    var userId: UserId? = null

    @JvmField
    protected var userId: UserId? = null
    var automation: UiAutomation? = null

    @JvmField
+14 −14
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.documentsui;

import static org.junit.Assert.assertNull;

import androidx.test.filters.LargeTest;

import com.android.documentsui.base.Providers;
@@ -23,26 +25,24 @@ import com.android.documentsui.base.RootInfo;
import com.android.documentsui.files.FilesActivity;
import com.android.documentsui.filters.HugeLongTest;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * A Ui test will do tests in the internal storage root. It is implemented because some operations
 * is failed and its result will different from the test on the StubProvider. b/115304092 is a
 * example which only happen on root from ExternalStorageProvidrer.
 * example which only happen on root from ExternalStorageProvider.
 */
@LargeTest
public class InternalStorageUiTest extends ActivityTest<FilesActivity> {
public class InternalStorageUiTest extends ActivityTestJunit4<FilesActivity> {

    private static final String fileName = "!Test3345678";
    private static final String newFileName = "!9527Test";
    private RootInfo rootPrimary;

    public InternalStorageUiTest() {
        super(FilesActivity.class);
    }

    @Override
    public void setUp() throws Exception {
        super.setUp();

    @Before
    public void setUpTest() throws Exception {
        mDocsHelper = new DocumentsProviderHelper(userId, Providers.AUTHORITY_STORAGE, context,
                Providers.AUTHORITY_STORAGE);
        rootPrimary = mDocsHelper.getRoot(Providers.ROOT_ID_DEVICE);
@@ -51,13 +51,13 @@ public class InternalStorageUiTest extends ActivityTest<FilesActivity> {
        deleteTestFiles();
    }

    @Override
    public void tearDown() throws Exception {
    @After
    public void tearDownTest() throws Exception {
        deleteTestFiles();
        super.tearDown();
    }

    @HugeLongTest
    @Test
    public void testRenameFile() throws Exception {
        createTestFiles();

@@ -97,7 +97,7 @@ public class InternalStorageUiTest extends ActivityTest<FilesActivity> {
        if (selected) {
            bots.main.clickDelete();
            device.waitForIdle();
            bots.main.clickDialogOkButton();
            bots.main.clickNonTextDialogOkButton();
        }
    }
}