Skip to content
Snippets Groups Projects
Commit 3ad7774b authored by Michael Rosenfeld's avatar Michael Rosenfeld
Browse files

Fix CompactMeminfo bug and use test to verify

Change-Id: I30ed2047edf93e528c020b4d571c55fa99c4e57b
parent b9b98773
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,7 @@ public class CompactMemInfoParser implements IParser {
if (m.group(6) != null && !"N/A".equals(m.group(6))) {
swap = Long.parseLong(m.group(6));
}
boolean activities = "a".equals(m.group(6));
boolean activities = "a".equals(m.group(7));
item.addPid(pid, name, type, pss, swap, activities);
continue;
} catch (NumberFormatException nfe) {
......
......@@ -28,8 +28,8 @@ import java.util.List;
public class CompactMemInfoParserTest extends TestCase {
public void testSingleProcLineWithSwap() {
List<String> input = Arrays.asList("proc,cached,com.google.android.youtube1,2964,19345,1005,e");
public void testSingleProcLineWithSwapHasActivities() {
List<String> input = Arrays.asList("proc,cached,com.google.android.youtube1,2964,19345,1005,a");
CompactMemInfoItem item = new CompactMemInfoParser().parse(input);
......@@ -38,10 +38,24 @@ public class CompactMemInfoParserTest extends TestCase {
assertEquals(19345, item.getPss(2964));
assertEquals(1005, item.getSwap(2964));
assertEquals("cached", item.getType(2964));
assertEquals(false, item.hasActivities(2964));
assertEquals(true, item.hasActivities(2964));
}
public void testSingleProcLineWithoutSwapHasActivities() {
List<String> input = Arrays.asList("proc,cached,com.google.android.youtube,2964,19345,a");
CompactMemInfoItem item = new CompactMemInfoParser().parse(input);
assertEquals(1, item.getPids().size());
assertEquals("com.google.android.youtube", item.getName(2964));
assertEquals(19345, item.getPss(2964));
assertEquals(0, item.getSwap(2964));
assertEquals("cached", item.getType(2964));
assertEquals(true, item.hasActivities(2964));
}
public void testSingleProcLineWithoutSwap() {
public void testSingleProcLineWithoutSwapNoActivities() {
List<String> input = Arrays.asList("proc,cached,com.google.android.youtube,2964,19345,e");
CompactMemInfoItem item = new CompactMemInfoParser().parse(input);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment