summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2010-03-04 10:08:02 -0800
committerSan Mehat <san@google.com>2010-03-04 10:08:29 -0800
commit9d05a18490dfac7ea705a6166f06af77a63c5534 (patch)
treeac56c0843e08f690dd0a297b7ab8d420fa24ac1c /tests
parent4a3c3b23d0aa87a68088976b4f397be116cd2338 (diff)
downloadframeworks_base-9d05a18490dfac7ea705a6166f06af77a63c5534.zip
frameworks_base-9d05a18490dfac7ea705a6166f06af77a63c5534.tar.gz
frameworks_base-9d05a18490dfac7ea705a6166f06af77a63c5534.tar.bz2
AsecTests: Add a test to validate container size
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/AndroidTests/src/com/android/unit_tests/AsecTests.java23
1 files changed, 11 insertions, 12 deletions
diff --git a/tests/AndroidTests/src/com/android/unit_tests/AsecTests.java b/tests/AndroidTests/src/com/android/unit_tests/AsecTests.java
index 5aaf13b..c7bacd4 100755
--- a/tests/AndroidTests/src/com/android/unit_tests/AsecTests.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/AsecTests.java
@@ -346,21 +346,20 @@ public class AsecTests extends AndroidTestCase {
}
}
- public void testIsContainerMountedAfterRename() {
+ public void testContainerSize() {
+ IMountService ms = getMs();
try {
Assert.assertEquals(StorageResultCode.OperationSucceeded,
- createContainer("testRenameContainer.1", 4, "none"));
-
- Assert.assertEquals(StorageResultCode.OperationSucceeded,
- unmountContainer("testRenameContainer.1", false));
-
- Assert.assertEquals(StorageResultCode.OperationSucceeded,
- renameContainer("testRenameContainer.1", "testRenameContainer.2"));
+ createContainer("testContainerSize", 1, "none"));
+ String path = ms.getSecureContainerPath("com.android.unittests.AsecTests.testUnmountBusyContainer");
- Assert.assertEquals(false, containerExists("testRenameContainer.1"));
- Assert.assertEquals(true, containerExists("testRenameContainer.2"));
- // Check if isContainerMounted returns valid value
- Assert.assertEquals(true, isContainerMounted("testRenameContainer.2"));
+ byte[] buf = new byte[4096];
+ File f = new File(path, "reference");
+ FileOutputStream fos = new FileOutputStream(f);
+ for (int i = 0; i < (1024 * 1024); i+= buf.length) {
+ fos.write(buf);
+ }
+ fos.close();
} catch (Exception e) {
failStr(e);
}