From d17d8b9a524a384a0d3503945df8ab96642fea1d Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Tue, 16 Feb 2016 12:45:16 +0100 Subject: [PATCH] Moved target folder for download test to private storage, to fix problems with runtime check of permissions in Android 6 --- .../android/lib/test_project/TestActivity.java | 4 ++-- .../lib/test_project/test/DownloadFileTest.java | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/test_client/src/com/owncloud/android/lib/test_project/TestActivity.java b/test_client/src/com/owncloud/android/lib/test_project/TestActivity.java index c399bb49..c9fd712a 100644 --- a/test_client/src/com/owncloud/android/lib/test_project/TestActivity.java +++ b/test_client/src/com/owncloud/android/lib/test_project/TestActivity.java @@ -227,8 +227,8 @@ public class TestActivity extends Activity { public RemoteOperationResult downloadFile(RemoteFile remoteFile, String temporalFolder) { // Create folder String path = "/owncloud/tmp/" + temporalFolder; - File sdCard = Environment.getExternalStorageDirectory(); - File folder = new File(sdCard.getAbsolutePath() + "/" + path); + File privateFolder = getFilesDir(); + File folder = new File(privateFolder.getAbsolutePath() + "/" + path); folder.mkdirs(); DownloadRemoteFileOperation downloadOperation = new DownloadRemoteFileOperation(remoteFile.getRemotePath(), folder.getAbsolutePath()); diff --git a/test_client/tests/src/com/owncloud/android/lib/test_project/test/DownloadFileTest.java b/test_client/tests/src/com/owncloud/android/lib/test_project/test/DownloadFileTest.java index ed04d443..04f36090 100644 --- a/test_client/tests/src/com/owncloud/android/lib/test_project/test/DownloadFileTest.java +++ b/test_client/tests/src/com/owncloud/android/lib/test_project/test/DownloadFileTest.java @@ -94,9 +94,8 @@ public class DownloadFileTest extends RemoteTest { */ public void testDownloadFile() { RemoteOperationResult result = mActivity.downloadFile( - new RemoteFile(mFullPath2Image), - mActivity.getFilesDir().getAbsolutePath() - ); + new RemoteFile(mFullPath2Image), "" + ); mDownloadedFilePath = mFullPath2Image; assertTrue(result.isSuccess()); // TODO some checks involving the local file @@ -107,9 +106,8 @@ public class DownloadFileTest extends RemoteTest { */ public void testDownloadFileSpecialChars() { RemoteOperationResult result = mActivity.downloadFile( - new RemoteFile(mFullPath2ImageWitSpecialChars), - mActivity.getFilesDir().getAbsolutePath() - ); + new RemoteFile(mFullPath2ImageWitSpecialChars), "" + ); mDownloadedFilePath = mFullPath2ImageWitSpecialChars; assertTrue(result.isSuccess()); // TODO some checks involving the local file @@ -120,9 +118,8 @@ public class DownloadFileTest extends RemoteTest { */ public void testDownloadFileNotFound() { RemoteOperationResult result = mActivity.downloadFile( - new RemoteFile(mFullPath2ImageNotFound), - mActivity.getFilesDir().getAbsolutePath() - ); + new RemoteFile(mFullPath2ImageNotFound), "" + ); assertFalse(result.isSuccess()); }