Loading services/tests/servicestests/src/com/android/server/utils/AnrTimerTest.java +8 −5 Original line number Original line Diff line number Diff line Loading @@ -147,7 +147,7 @@ public class AnrTimerTest { final int n = 4; final int n = 4; StackTraceElement[] stack = Thread.currentThread().getStackTrace(); StackTraceElement[] stack = Thread.currentThread().getStackTrace(); if (stack.length < n+1) return "test"; if (stack.length < n+1) return "test"; return stack[n].getMethodName(); return stack[n].getClassName() + "." + stack[n].getMethodName(); } } } } Loading Loading @@ -318,8 +318,11 @@ public class AnrTimerTest { public void testDumpOutput() throws Exception { public void testDumpOutput() throws Exception { if (!AnrTimer.nativeTimersSupported()) return; if (!AnrTimer.nativeTimersSupported()) return; // The timers in this class are named "class.method". final String timerName = "timer: com.android.server.utils.AnrTimerTest"; String r1 = getDumpOutput(); String r1 = getDumpOutput(); assertThat(r1).doesNotContain("timer:"); assertThat(r1).doesNotContain(timerName); Helper helper = new Helper(2); Helper helper = new Helper(2); TestArg t1 = new TestArg(1, 1); TestArg t1 = new TestArg(1, 1); Loading @@ -333,14 +336,14 @@ public class AnrTimerTest { String r2 = getDumpOutput(); String r2 = getDumpOutput(); // There are timers in the list if and only if the feature is enabled. // There are timers in the list if and only if the feature is enabled. if (mEnabled) { if (mEnabled) { assertThat(r2).contains("timer:"); assertThat(r2).contains(timerName); } else { } else { assertThat(r2).doesNotContain("timer:"); assertThat(r2).doesNotContain(timerName); } } } } String r3 = getDumpOutput(); String r3 = getDumpOutput(); assertThat(r3).doesNotContain("timer:"); assertThat(r3).doesNotContain(timerName); } } /** /** Loading Loading
services/tests/servicestests/src/com/android/server/utils/AnrTimerTest.java +8 −5 Original line number Original line Diff line number Diff line Loading @@ -147,7 +147,7 @@ public class AnrTimerTest { final int n = 4; final int n = 4; StackTraceElement[] stack = Thread.currentThread().getStackTrace(); StackTraceElement[] stack = Thread.currentThread().getStackTrace(); if (stack.length < n+1) return "test"; if (stack.length < n+1) return "test"; return stack[n].getMethodName(); return stack[n].getClassName() + "." + stack[n].getMethodName(); } } } } Loading Loading @@ -318,8 +318,11 @@ public class AnrTimerTest { public void testDumpOutput() throws Exception { public void testDumpOutput() throws Exception { if (!AnrTimer.nativeTimersSupported()) return; if (!AnrTimer.nativeTimersSupported()) return; // The timers in this class are named "class.method". final String timerName = "timer: com.android.server.utils.AnrTimerTest"; String r1 = getDumpOutput(); String r1 = getDumpOutput(); assertThat(r1).doesNotContain("timer:"); assertThat(r1).doesNotContain(timerName); Helper helper = new Helper(2); Helper helper = new Helper(2); TestArg t1 = new TestArg(1, 1); TestArg t1 = new TestArg(1, 1); Loading @@ -333,14 +336,14 @@ public class AnrTimerTest { String r2 = getDumpOutput(); String r2 = getDumpOutput(); // There are timers in the list if and only if the feature is enabled. // There are timers in the list if and only if the feature is enabled. if (mEnabled) { if (mEnabled) { assertThat(r2).contains("timer:"); assertThat(r2).contains(timerName); } else { } else { assertThat(r2).doesNotContain("timer:"); assertThat(r2).doesNotContain(timerName); } } } } String r3 = getDumpOutput(); String r3 = getDumpOutput(); assertThat(r3).doesNotContain("timer:"); assertThat(r3).doesNotContain(timerName); } } /** /** Loading