Bug 1013004 - Allow more time for ANR reports; r=snorp

This commit is contained in:
Jim Chen
2014-10-16 15:46:41 -04:00
parent 85d2dd7949
commit ad5bfd549c
2 changed files with 10 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ public class testANRReporter extends BaseTest {
private static final String ANR_ACTION = "android.intent.action.ANR"; private static final String ANR_ACTION = "android.intent.action.ANR";
private static final String PING_DIR = "saved-telemetry-pings"; private static final String PING_DIR = "saved-telemetry-pings";
private static final int WAIT_FOR_PING_TIMEOUT = 10000; private static final int WAIT_FOR_PING_TIMEOUT = 60000;
private static final String ANR_PATH = "/data/anr/traces.txt"; private static final String ANR_PATH = "/data/anr/traces.txt";
private static final String SAMPLE_ANR private static final String SAMPLE_ANR
= "----- pid 1 at 2014-01-15 18:55:51 -----\n" = "----- pid 1 at 2014-01-15 18:55:51 -----\n"
@@ -159,10 +159,17 @@ public class testANRReporter extends BaseTest {
mAsserter.info("Triggering second ANR", null); mAsserter.info("Triggering second ANR", null);
testContext.sendBroadcast(new Intent(anrIntent)); testContext.sendBroadcast(new Intent(anrIntent));
mAsserter.info("Waiting for ping", null);
waitForCondition(new Condition() { waitForCondition(new Condition() {
@Override @Override
public boolean isSatisfied() { public boolean isSatisfied() {
mAsserter.info("Waiting for ping", null);
try {
// Sleep to allow the ANR reporter thread time to process the ANR.
Thread.sleep(1000);
} catch (final InterruptedException e) {
}
final File[] newFiles = pingDir.listFiles(); final File[] newFiles = pingDir.listFiles();
if (newFiles == null || newFiles.length == 0) { if (newFiles == null || newFiles.length == 0) {
// Keep waiting. // Keep waiting.

View File

@@ -16,7 +16,6 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <sched.h>
#include "nsAppShell.h" #include "nsAppShell.h"
#include "nsWindow.h" #include "nsWindow.h"
@@ -1029,7 +1028,7 @@ Java_org_mozilla_gecko_ANRReporter_getNativeStack(JNIEnv* jenv, jclass)
if (PR_IntervalNow() - startTime >= timeout) { if (PR_IntervalNow() - startTime >= timeout) {
return nullptr; return nullptr;
} }
sched_yield(); usleep(100000ul); // Sleep for 100ms
profile = ProfilePtr(profiler_get_profile()); profile = ProfilePtr(profiler_get_profile());
} }