summaryrefslogtreecommitdiffstats
path: root/core/tests
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2012-08-16 16:43:20 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-08-16 16:43:20 -0700
commit9a994b5350731b8169a9b25463f57266ee2988fb (patch)
tree670fdf9ade80e54995c73f7a80a023ff9836fa79 /core/tests
parent13c589b66c47aa4d988eecce9a12c39d580939c9 (diff)
parent050c87f87e2a48c7bc90f5b15fb6e4e37e667286 (diff)
downloadframeworks_base-9a994b5350731b8169a9b25463f57266ee2988fb.zip
frameworks_base-9a994b5350731b8169a9b25463f57266ee2988fb.tar.gz
frameworks_base-9a994b5350731b8169a9b25463f57266ee2988fb.tar.bz2
am 050c87f8: am a950daf5: Merge changes Ieb566a2a,I953057cd
* commit '050c87f87e2a48c7bc90f5b15fb6e4e37e667286': Use Libcore's stat instead of FileUtils#getFileStatus Use Libcore.os.stat instead of FileUtils
Diffstat (limited to 'core/tests')
-rw-r--r--core/tests/coretests/src/android/os/FileUtilsTest.java64
1 files changed, 1 insertions, 63 deletions
diff --git a/core/tests/coretests/src/android/os/FileUtilsTest.java b/core/tests/coretests/src/android/os/FileUtilsTest.java
index f12cbe1..4d0b892 100644
--- a/core/tests/coretests/src/android/os/FileUtilsTest.java
+++ b/core/tests/coretests/src/android/os/FileUtilsTest.java
@@ -17,21 +17,13 @@
package android.os;
import android.content.Context;
-import android.os.FileUtils;
-import android.os.FileUtils.FileStatus;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.SmallTest;
import java.io.ByteArrayInputStream;
import java.io.File;
-import java.io.FileWriter;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
-import java.io.IOException;
-
-import junit.framework.Assert;
+import java.io.FileWriter;
public class FileUtilsTest extends AndroidTestCase {
private static final String TEST_DATA =
@@ -60,60 +52,6 @@ public class FileUtilsTest extends AndroidTestCase {
if (mCopyFile.exists()) mCopyFile.delete();
}
- @LargeTest
- public void testGetFileStatus() {
- final byte[] MAGIC = { 0xB, 0xE, 0x0, 0x5 };
-
- try {
- // truncate test file and write MAGIC (4 bytes) to it.
- FileOutputStream os = new FileOutputStream(mTestFile, false);
- os.write(MAGIC, 0, 4);
- os.flush();
- os.close();
- } catch (FileNotFoundException e) {
- Assert.fail("File was removed durning test" + e);
- } catch (IOException e) {
- Assert.fail("Unexpected IOException: " + e);
- }
-
- Assert.assertTrue(mTestFile.exists());
- Assert.assertTrue(FileUtils.getFileStatus(mTestFile.getPath(), null));
-
- FileStatus status1 = new FileStatus();
- FileUtils.getFileStatus(mTestFile.getPath(), status1);
-
- Assert.assertEquals(4, status1.size);
-
- // Sleep for at least one second so that the modification time will be different.
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
-
- try {
- // append so we don't change the creation time.
- FileOutputStream os = new FileOutputStream(mTestFile, true);
- os.write(MAGIC, 0, 4);
- os.flush();
- os.close();
- } catch (FileNotFoundException e) {
- Assert.fail("File was removed durning test" + e);
- } catch (IOException e) {
- Assert.fail("Unexpected IOException: " + e);
- }
-
- FileStatus status2 = new FileStatus();
- FileUtils.getFileStatus(mTestFile.getPath(), status2);
-
- Assert.assertEquals(8, status2.size);
- Assert.assertTrue(status2.mtime > status1.mtime);
-
- mTestFile.delete();
-
- Assert.assertFalse(mTestFile.exists());
- Assert.assertFalse(FileUtils.getFileStatus(mTestFile.getPath(), null));
- }
-
// TODO: test setPermissions(), getPermissions()
@MediumTest