Search in sources :

Example 86 with Uri

use of android.net.Uri in project platform_frameworks_base by android.

the class AbstractCopyJobTest method runCopyVirtualTypedFileTest.

public void runCopyVirtualTypedFileTest() throws Exception {
    Uri testFile = mDocs.createVirtualFile(mSrcRoot, "/virtual.sth", "virtual/mime-type", FRUITY_BYTES, "application/pdf", "text/html");
    createJob(newArrayList(testFile)).run();
    mJobListener.waitForFinished();
    mDocs.assertChildCount(mDestRoot, 1);
    // copy should convert file to PDF.
    mDocs.assertHasFile(mDestRoot, "virtual.sth.pdf");
    mDocs.assertFileContents(mDestRoot.documentId, "virtual.sth.pdf", FRUITY_BYTES);
}
Also used : Uri(android.net.Uri)

Example 87 with Uri

use of android.net.Uri in project platform_frameworks_base by android.

the class AbstractCopyJobTest method runNoCopyDirToDescendentTest.

public void runNoCopyDirToDescendentTest() throws Exception {
    Uri testDir = mDocs.createFolder(mSrcRoot, "someDir");
    Uri destDir = mDocs.createFolder(testDir, "theDescendent");
    createJob(newArrayList(testDir), DocumentsContract.buildDocumentUri(AUTHORITY, mSrcRoot.documentId), destDir).run();
    mJobListener.waitForFinished();
    mJobListener.assertFailed();
    mJobListener.assertFilesFailed(newArrayList("someDir"));
    mDocs.assertChildCount(mDestRoot, 0);
}
Also used : Uri(android.net.Uri)

Example 88 with Uri

use of android.net.Uri in project platform_frameworks_base by android.

the class AbstractCopyJobTest method runCopyEmptyDirTest.

public void runCopyEmptyDirTest() throws Exception {
    Uri testDir = mDocs.createFolder(mSrcRoot, "emptyDir");
    createJob(newArrayList(testDir)).run();
    mJobListener.waitForFinished();
    mDocs.assertChildCount(mDestRoot, 1);
    mDocs.assertHasDirectory(mDestRoot, "emptyDir");
}
Also used : Uri(android.net.Uri)

Example 89 with Uri

use of android.net.Uri in project platform_frameworks_base by android.

the class AbstractJobTest method createJob.

final T createJob(List<Uri> srcs, Uri srcParent, Uri destination) throws Exception {
    DocumentStack stack = new DocumentStack();
    stack.push(DocumentInfo.fromUri(mResolver, destination));
    List<DocumentInfo> srcDocs = Lists.newArrayList();
    for (Uri src : srcs) {
        srcDocs.add(DocumentInfo.fromUri(mResolver, src));
    }
    return createJob(srcDocs, DocumentInfo.fromUri(mResolver, srcParent), stack);
}
Also used : DocumentStack(com.android.documentsui.model.DocumentStack) Uri(android.net.Uri) DocumentInfo(com.android.documentsui.model.DocumentInfo)

Example 90 with Uri

use of android.net.Uri in project platform_frameworks_base by android.

the class CopyJobTest method testCopy_BackendSideVirtualTypedFile_Fallback.

public void testCopy_BackendSideVirtualTypedFile_Fallback() throws Exception {
    mDocs.assertChildCount(mDestRoot, 0);
    Uri testFile = mDocs.createDocumentWithFlags(mSrcRoot.documentId, "virtual/mime-type", "tokyo.sth", Document.FLAG_VIRTUAL_DOCUMENT | Document.FLAG_SUPPORTS_COPY | Document.FLAG_SUPPORTS_MOVE, "application/pdf");
    createJob(newArrayList(testFile)).run();
    mJobListener.waitForFinished();
    mDocs.assertChildCount(mDestRoot, 1);
    // Copy should convert file to PDF.
    mDocs.assertHasFile(mDestRoot, "tokyo.sth.pdf");
}
Also used : Uri(android.net.Uri)

Aggregations

Uri (android.net.Uri)3406 Intent (android.content.Intent)732 Cursor (android.database.Cursor)466 ContentValues (android.content.ContentValues)349 File (java.io.File)339 IOException (java.io.IOException)254 ContentResolver (android.content.ContentResolver)242 ArrayList (java.util.ArrayList)209 Test (org.junit.Test)194 RemoteException (android.os.RemoteException)190 Bundle (android.os.Bundle)154 Bitmap (android.graphics.Bitmap)129 Context (android.content.Context)118 InputStream (java.io.InputStream)110 PendingIntent (android.app.PendingIntent)104 LargeTest (android.test.suitebuilder.annotation.LargeTest)97 View (android.view.View)95 FileNotFoundException (java.io.FileNotFoundException)94 Request (android.app.DownloadManager.Request)83 TextView (android.widget.TextView)73