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

Commit b043488c authored by Zemiao Zhu's avatar Zemiao Zhu Committed by Automerger Merge Worker
Browse files

Merge "Deflake FileCopyUiTest by fixing tearDown and setup." into rvc-dev am:...

Merge "Deflake FileCopyUiTest by fixing tearDown and setup." into rvc-dev am: c91ac6bb am: 001bcb87 am: 93aa6036 am: 2b7692d3

Change-Id: I77a71a60faf6aef1cd527168c691a3c1f665f07f
parents 775519f6 2b7692d3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ import androidx.test.InstrumentationRegistry;
 */
public final class Bots {

    private static final int TIMEOUT = 5000;
    private static final int TIMEOUT = 15000;

    public final BreadBot breadcrumb;
    public final DirectoryListBot directory;
+19 −1
Original line number Diff line number Diff line
@@ -153,8 +153,13 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> {
            mIsVirtualSdCard = enableVirtualSdCard();
            assertTrue("Cannot set virtual SD Card", mIsVirtualSdCard);
            // Call initStorageRootInfo() again for setting SD Card root
            int attempts = 0;
            while (mSdCardRoot == null && attempts++ < 15) {
                SystemClock.sleep(1000);
                initStorageRootInfo();
            }
            assertNotNull("Cannot find virtual SD Card", mSdCardRoot);
        }

        IntentFilter filter = new IntentFilter();
        filter.addAction(TestNotificationService.ACTION_OPERATION_RESULT);
@@ -173,8 +178,21 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> {
            deleteDocuments(rootAndFolder.root, rootAndFolder.folder);
        }

        // Eject virtual SD card
        if (mIsVirtualSdCard) {
            device.executeShellCommand("sm set-virtual-disk false");
            while (mSdCardRoot != null) {
                List<RootInfo> rootList = mStorageDocsHelper.getRootList();
                for (RootInfo info : rootList) {
                    if (info.isSd()) {
                        SystemClock.sleep(1000);
                        break;
                    }

                    mSdCardRoot = null;
                    mSdCardLabel = null;
                }
            }
        }

        device.executeShellCommand("settings put global stay_on_while_plugged_in "