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

Commit 2b7692d3 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

Change-Id: I922605f2c1e8748b625ee5f11806977115f8d393
parents 609c64ec 93aa6036
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 "