diff options
Diffstat (limited to 'tools/ahat/test/DiffTest.java')
-rw-r--r-- | tools/ahat/test/DiffTest.java | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/tools/ahat/test/DiffTest.java b/tools/ahat/test/DiffTest.java index cfd0236ab3..585f29ae61 100644 --- a/tools/ahat/test/DiffTest.java +++ b/tools/ahat/test/DiffTest.java @@ -18,26 +18,7 @@ package com.android.ahat; import com.android.ahat.heapdump.AhatHeap; import com.android.ahat.heapdump.AhatInstance; -import com.android.ahat.heapdump.AhatSnapshot; -import com.android.ahat.heapdump.Diff; -import com.android.tools.perflib.heap.hprof.HprofClassDump; -import com.android.tools.perflib.heap.hprof.HprofConstant; -import com.android.tools.perflib.heap.hprof.HprofDumpRecord; -import com.android.tools.perflib.heap.hprof.HprofHeapDump; -import com.android.tools.perflib.heap.hprof.HprofInstanceDump; -import com.android.tools.perflib.heap.hprof.HprofInstanceField; -import com.android.tools.perflib.heap.hprof.HprofLoadClass; -import com.android.tools.perflib.heap.hprof.HprofPrimitiveArrayDump; -import com.android.tools.perflib.heap.hprof.HprofRecord; -import com.android.tools.perflib.heap.hprof.HprofRootDebugger; -import com.android.tools.perflib.heap.hprof.HprofStaticField; -import com.android.tools.perflib.heap.hprof.HprofStringBuilder; -import com.android.tools.perflib.heap.hprof.HprofType; -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -98,41 +79,4 @@ public class DiffTest { AhatHandler handler = new ObjectsHandler(dump.getAhatSnapshot()); TestHandler.testNoCrash(handler, "http://localhost:7100/objects?class=java.lang.Class"); } - - @Test - public void nullClassObj() throws IOException { - // Set up a heap dump that has a null classObj. - // The heap dump is derived from the InstanceTest.asStringEmbedded test. - HprofStringBuilder strings = new HprofStringBuilder(0); - List<HprofRecord> records = new ArrayList<HprofRecord>(); - List<HprofDumpRecord> dump = new ArrayList<HprofDumpRecord>(); - - final int stringClassObjectId = 1; - records.add(new HprofLoadClass(0, 0, stringClassObjectId, 0, strings.get("java.lang.String"))); - dump.add(new HprofClassDump(stringClassObjectId, 0, 0, 0, 0, 0, 0, 0, 0, - new HprofConstant[0], new HprofStaticField[0], - new HprofInstanceField[]{ - new HprofInstanceField(strings.get("count"), HprofType.TYPE_INT), - new HprofInstanceField(strings.get("hashCode"), HprofType.TYPE_INT), - new HprofInstanceField(strings.get("offset"), HprofType.TYPE_INT), - new HprofInstanceField(strings.get("value"), HprofType.TYPE_OBJECT)})); - - dump.add(new HprofPrimitiveArrayDump(0x41, 0, HprofType.TYPE_CHAR, - new long[]{'n', 'o', 't', ' ', 'h', 'e', 'l', 'l', 'o', 'o', 'p'})); - - ByteArrayDataOutput values = ByteStreams.newDataOutput(); - values.writeInt(5); // count - values.writeInt(0); // hashCode - values.writeInt(4); // offset - values.writeInt(0x41); // value - dump.add(new HprofInstanceDump(0x42, 0, stringClassObjectId, values.toByteArray())); - dump.add(new HprofRootDebugger(stringClassObjectId)); - dump.add(new HprofRootDebugger(0x42)); - - records.add(new HprofHeapDump(0, dump.toArray(new HprofDumpRecord[0]))); - AhatSnapshot snapshot = SnapshotBuilder.makeSnapshot(strings, records); - - // Diffing should not crash. - Diff.snapshots(snapshot, snapshot); - } } |