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);
}
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);
}
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");
}
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);
}
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");
}
Aggregations