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

Commit 6a1fe3dc authored by Diksha Gohlyan's avatar Diksha Gohlyan Committed by Android (Google) Code Review
Browse files

Merge "Move some other functional tests to functional" into rvc-dev

parents 652a28ed fcbff758
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ android_library {
}

android_library {
    name: "DocumentsUI-res-lib-tests",
    name: "DocumentsUIUnitTests-res-lib",

    manifest: "AndroidManifestForUnitTests.xml",

+0 −92
Original line number Diff line number Diff line
@@ -35,97 +35,5 @@
    <uses-permission
        android:name="android.permission.READ_COMPAT_CHANGE_CONFIG" />

    <application android:name=".DocumentsApplication"
            android:label="@string/app_label" android:icon="@drawable/app_icon"
            android:supportsRtl="true" android:allowBackup="true"
            android:backupAgent=".prefs.BackupAgent"
            android:fullBackupOnly="false" android:crossProfile="true">

        <activity android:name=".picker.PickActivity"
                android:theme="@style/DocumentsTheme"
                android:visibleToInstantApps="true">
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.OPEN_DOCUMENT" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.OPENABLE" />
                <data android:mimeType="*/*" />
            </intent-filter>
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.CREATE_DOCUMENT" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.OPENABLE" />
                <data android:mimeType="*/*" />
            </intent-filter>
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.GET_CONTENT" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.OPENABLE" />
                <data android:mimeType="*/*" />
            </intent-filter>
            <intent-filter android:priority="100">
                <action android:name="android.intent.action.OPEN_DOCUMENT_TREE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity android:name=".files.LauncherActivity"
                android:label="@string/launcher_label"
                android:icon="@drawable/launcher_icon"
                android:theme="@android:style/Theme.NoDisplay"></activity>

        <activity android:name=".inspector.InspectorActivity"
                android:label="@string/menu_inspect"
                android:icon="@drawable/launcher_icon"
                android:theme="@style/DocumentsTheme"></activity>

        <!--  Preserve original launcher activity from Nougat. -->
        <activity-alias android:name=".LauncherActivity"
                android:targetActivity=".files.LauncherActivity"
                android:label="@string/launcher_label"
                android:icon="@drawable/launcher_icon">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.APP_FILES" />
            </intent-filter>
            <meta-data android:name="android.app.shortcuts"
                    android:resource="@xml/shortcuts" />
        </activity-alias>

        <activity android:name=".files.FilesActivity"
                android:documentLaunchMode="intoExisting"
                android:theme="@style/DocumentsTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.document/root" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.document/directory" />
            </intent-filter>
        </activity>

        <activity-alias android:name=".ViewDownloadsActivity"
                android:targetActivity=".files.FilesActivity"
                android:enabled="@bool/handle_view_downloads_intent">
            <intent-filter>
                <action android:name="android.intent.action.VIEW_DOWNLOADS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity-alias>

        <activity android:name=".ScopedAccessActivity"
                android:theme="@android:style/Theme.Translucent.NoTitleBar">
            <intent-filter>
                <action android:name="android.os.storage.action.OPEN_EXTERNAL_DIRECTORY" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>

</manifest>
+5 −5
Original line number Diff line number Diff line
@@ -16,9 +16,13 @@

package com.android.documentsui.archives;

import static android.os.ParcelFileDescriptor.MODE_READ_ONLY;

import android.os.ParcelFileDescriptor;
import android.util.Log;

import androidx.test.platform.app.InstrumentationRegistry;

import org.apache.commons.compress.utils.IOUtils;
import org.junit.rules.TestName;
import org.junit.runner.Description;
@@ -38,10 +42,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Set;

import androidx.test.platform.app.InstrumentationRegistry;

import static android.os.ParcelFileDescriptor.MODE_READ_ONLY;

public class ArchiveFileTestRule extends TestName {
    private static final String TAG = ArchiveFileTestRule.class.getSimpleName();

+10 −9
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.documentsui.archives;

import static com.google.common.truth.Truth.assertThat;

import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -27,6 +28,13 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.test.runner.AndroidJUnit4;

import org.apache.commons.compress.archivers.ArchiveEntry;
import org.apache.commons.compress.archivers.ArchiveException;
import org.apache.commons.compress.compressors.CompressorException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -36,13 +44,6 @@ import java.util.Enumeration;
import java.util.List;
import java.util.Locale;

import org.apache.commons.compress.archivers.ArchiveEntry;
import org.apache.commons.compress.archivers.ArchiveException;
import org.apache.commons.compress.compressors.CompressorException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
public class ArchiveHandleTest {
    @Rule
+9 −9
Original line number Diff line number Diff line
@@ -38,12 +38,6 @@ import androidx.test.runner.AndroidJUnit4;

import com.android.documentsui.tests.R;

import java.io.IOException;
import java.util.Scanner;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import org.apache.commons.compress.archivers.ArchiveException;
import org.apache.commons.compress.compressors.CompressorException;
import org.junit.After;
@@ -51,9 +45,16 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.io.IOException;
import java.util.Scanner;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

@RunWith(AndroidJUnit4.class)
@MediumTest
public class ReadableArchiveTest {

    private static final Uri ARCHIVE_URI = Uri.parse("content://i/love/strawberries");
    private static final String NOTIFICATION_URI =
            "content://com.android.documentsui.archives/notification-uri";
@@ -145,7 +146,6 @@ public class ReadableArchiveTest {
        assertEquals(0,
                cursor.getInt(cursor.getColumnIndexOrThrow(Document.COLUMN_SIZE)));


        // Check if querying children works too.
        final Cursor childCursor = mArchive.queryChildDocuments(
                createArchiveId("/dir1/").toDocumentId(), null, null);
@@ -394,7 +394,7 @@ public class ReadableArchiveTest {
                createArchiveId("/dir2/strawberries.txt").toDocumentId(),
                "r", null /* signal */);
        assertTrue(Archive.canSeek(descriptor));
        try (final ParcelFileDescriptor.AutoCloseInputStream inputStream =
        try (ParcelFileDescriptor.AutoCloseInputStream inputStream =
                new ParcelFileDescriptor.AutoCloseInputStream(descriptor)) {
            Os.lseek(descriptor.getFileDescriptor(), "I love ".length(), OsConstants.SEEK_SET);
            assertEquals("strawberries!", new Scanner(inputStream).nextLine());
Loading