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

Commit 12855dc9 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: c91ac6bb

Change-Id: Ia62f67345493c18ec1db5ef5699b1cb9edf077a1
parents 14a9e7e9 c91ac6bb
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 "