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

Commit 66bcff6e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix some of tests doesn't run on presubmit"

parents a0bf4f77 c181d524
Loading
Loading
Loading
Loading
+49 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.documentsui.filters;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Marks a test that should run as part of the Huge and take a long time tests.
 *
 * Please mark the test whose duration is larger than 10 seconds.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface HugeLongTest {
}
+5 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.util.Log;
import androidx.test.filters.LargeTest;

import com.android.documentsui.files.FilesActivity;
import com.android.documentsui.filters.HugeLongTest;
import com.android.documentsui.services.TestNotificationService;

import java.util.concurrent.CountDownLatch;
@@ -141,6 +142,7 @@ public class CancelFromNotificationUiTest extends ActivityTest<FilesActivity> {
        }
    }

    @HugeLongTest
    public void testCopyDocument_Cancel() throws Exception {
        bots.roots.openRoot(ROOT_0_ID);

@@ -159,6 +161,7 @@ public class CancelFromNotificationUiTest extends ActivityTest<FilesActivity> {
        bots.directory.waitForDocument(TARGET_FILE);
    }

    @HugeLongTest
    public void testCopyDocument_CancelFromNotification() throws Exception {
        bots.roots.openRoot(ROOT_0_ID);
        bots.directory.findDocument(TARGET_FILE);
@@ -191,6 +194,7 @@ public class CancelFromNotificationUiTest extends ActivityTest<FilesActivity> {
        assertTrue(bots.directory.hasDocuments(TARGET_FILE));
    }

    @HugeLongTest
    public void testMoveDocument_Cancel() throws Exception {
        bots.roots.openRoot(ROOT_0_ID);

@@ -209,6 +213,7 @@ public class CancelFromNotificationUiTest extends ActivityTest<FilesActivity> {
        bots.directory.waitForDocument(TARGET_FILE);
    }

    @HugeLongTest
    public void testMoveDocument_CancelFromNotification() throws Exception {
        bots.roots.openRoot(ROOT_0_ID);
        bots.directory.findDocument(TARGET_FILE);
+6 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.documentsui;
import androidx.test.filters.LargeTest;

import com.android.documentsui.files.FilesActivity;
import com.android.documentsui.filters.HugeLongTest;

@LargeTest
public class DirectoryMessagesUiTest extends ActivityTest<FilesActivity> {
@@ -45,12 +46,14 @@ public class DirectoryMessagesUiTest extends ActivityTest<FilesActivity> {
        bots.directory.assertHasMessageButtonText("SIGN IN");
    }

    @HugeLongTest
    public void testInfoMessage_visible() throws Exception {
        bots.directory.openDocument(DemoProvider.DIR_INFO);
        bots.directory.assertHasMessage(DemoProvider.MSG_INFO);
        bots.directory.assertHasMessageButtonText("DISMISS");
    }

    @HugeLongTest
    public void testInfoMessage_dismissable() throws Exception {
        bots.directory.openDocument(DemoProvider.DIR_INFO);
        bots.directory.assertHasMessage(true);
@@ -58,12 +61,14 @@ public class DirectoryMessagesUiTest extends ActivityTest<FilesActivity> {
        bots.directory.assertHasMessage(false);
    }

    @HugeLongTest
    public void testErrorMessage_visible() throws Exception {
        bots.directory.openDocument(DemoProvider.DIR_ERROR);
        bots.directory.assertHasMessage(DemoProvider.MSG_ERROR);
        bots.directory.assertHasMessageButtonText("DISMISS");
    }

    @HugeLongTest
    public void testErrorMessage_dismissable() throws Exception {
        bots.directory.openDocument(DemoProvider.DIR_ERROR);
        bots.directory.assertHasMessage(true);
@@ -71,6 +76,7 @@ public class DirectoryMessagesUiTest extends ActivityTest<FilesActivity> {
        bots.directory.assertHasMessage(false);
    }

    @HugeLongTest
    public void testErrorMessage_supercedesInfoMessage() throws Exception {
        // When both error and info are returned in Directory, only show the error.
        bots.directory.openDocument(DemoProvider.DIR_ERROR_AND_INFO);
+5 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import com.android.documentsui.base.DocumentInfo;
import com.android.documentsui.base.RootInfo;
import com.android.documentsui.base.State;
import com.android.documentsui.files.FilesActivity;
import com.android.documentsui.filters.HugeLongTest;
import com.android.documentsui.services.TestNotificationService;

import java.util.HashMap;
@@ -371,6 +372,7 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> {
    }

    // Copy Internal Storage -> Internal Storage //
    @HugeLongTest
    public void testCopyDocuments_InternalStorage() throws Exception {
        createDocuments(StubProvider.ROOT_0_ID, rootDir0, mDocsHelper);
        copyFiles(StubProvider.ROOT_0_ID, StubProvider.ROOT_1_ID);
@@ -384,6 +386,7 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> {
    }

    // Copy SD Card -> Internal Storage //
    @HugeLongTest
    public void testCopyDocuments_FromSdCard() throws Exception {
        createDocuments(mSdCardLabel, mSdCardRoot, mStorageDocsHelper);
        copyFiles(mSdCardLabel, Build.MODEL);
@@ -397,6 +400,7 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> {
    }

    // Copy Internal Storage -> SD Card //
    @HugeLongTest
    public void testCopyDocuments_ToSdCard() throws Exception {
        createDocuments(Build.MODEL, mPrimaryRoot, mStorageDocsHelper);
        copyFiles(Build.MODEL, mSdCardLabel);
@@ -409,6 +413,7 @@ public class FileCopyUiTest extends ActivityTest<FilesActivity> {
        assertFilesCopied(mSdCardLabel, mSdCardRoot, mStorageDocsHelper);
    }

    @HugeLongTest
    public void testCopyDocuments_documentsDisabled() throws Exception {
        mDocsHelper.createDocument(rootDir0, "text/plain", fileName1);
        bots.roots.openRoot(StubProvider.ROOT_0_ID);
+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import androidx.test.filters.LargeTest;

import com.android.documentsui.base.DocumentInfo;
import com.android.documentsui.files.FilesActivity;
import com.android.documentsui.filters.HugeLongTest;
import com.android.documentsui.services.TestNotificationService;

import java.util.ArrayList;
@@ -156,6 +157,7 @@ public class FileDeleteUiTest extends ActivityTest<FilesActivity> {
        exec.shutdown();
    }

    @HugeLongTest
    public void testDeleteAllDocument() throws Exception {
        bots.roots.openRoot(ROOT_0_ID);
        bots.main.clickToolbarOverflowItem(
Loading