diff options
author | Carl Shapiro <cshapiro@google.com> | 2011-01-12 14:20:27 -0800 |
---|---|---|
committer | Carl Shapiro <cshapiro@google.com> | 2011-01-12 14:20:27 -0800 |
commit | d3b8eb098d88c15173586cf034ed977decdb7685 (patch) | |
tree | 84986be36eeb5ec69f6e12c1cab8189b1f23585b /tests/CoreTests | |
parent | fb0a242be65e4ddbda0cbaec1ac949d29568ac25 (diff) | |
download | frameworks_base-d3b8eb098d88c15173586cf034ed977decdb7685.zip frameworks_base-d3b8eb098d88c15173586cf034ed977decdb7685.tar.gz frameworks_base-d3b8eb098d88c15173586cf034ed977decdb7685.tar.bz2 |
Remove minimum heap size test now that the underlying interface is gone.
Change-Id: I4431247286dfd93ad0c3af9ebbba2ece92c35308
Diffstat (limited to 'tests/CoreTests')
-rw-r--r-- | tests/CoreTests/android/core/HeapTest.java | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/tests/CoreTests/android/core/HeapTest.java b/tests/CoreTests/android/core/HeapTest.java index 98cb28a..400d041 100644 --- a/tests/CoreTests/android/core/HeapTest.java +++ b/tests/CoreTests/android/core/HeapTest.java @@ -46,73 +46,6 @@ public class HeapTest extends TestCase { return new WeakReference<Object>(new Object()); } - /** - * Allocates the specified number of bytes. This is done in a separate method - * to ensure that the Object's address isn't sitting in a stale local register. - */ - private void allocateMemory(int size) { - byte[] b = new byte[size]; - } - - @MediumTest - public void testMinimumHeapSize() throws Exception { - VMRuntime r = VMRuntime.getRuntime(); - final boolean RUN_FLAKY = false; - - long origSize = r.getMinimumHeapSize(); - if (RUN_FLAKY) { - /* Check that the default value is zero. This will break if anyone - * in this process sets the minimum heap size to a positive value - * before calling this test. - */ - assertTrue(origSize == 0); - } - - long size = 4 * 1024 * 1024; - long oldSize = r.setMinimumHeapSize(size); - assertTrue(oldSize == origSize); - - long newSize = r.getMinimumHeapSize(); - /* This will fail if the maximum heap size (-Xmx) is smaller than 4MB. - */ - assertTrue(newSize == size); - - /* Make sure that getting the size doesn't change anything. - */ - newSize = r.getMinimumHeapSize(); - assertTrue(newSize == size); - - /* This test is flaky; if the heap is already large and fragmented, - * it can fail. It can also fail if another thread causes a GC - * at the wrong time. - */ - if (RUN_FLAKY) { - /* Increase the minimum size, allocate a big object, and make sure that - * a GC didn't happen. - */ - WeakReference ref = newRef(); - assertNotNull(ref.get()); - - r.setMinimumHeapSize(8 * 1024 * 1024); - allocateMemory(4 * 1024 * 1024); - - /* If a GC happened, this reference will be null. - */ - assertNotNull(ref.get()); - } - - /* Restore the original setting. - */ - r.setMinimumHeapSize(origSize); - newSize = r.getMinimumHeapSize(); - assertTrue(newSize == origSize); - - /* Clean up any large stuff we've allocated, - * and re-establish the normal utilization ratio. - */ - Runtime.getRuntime().gc(); - } - private static void makeRefs(Object objects[], SoftReference<Object> refs[]) { for (int i = 0; i < objects.length; i++) { objects[i] = (Object) new byte[8 * 1024]; |