Merge "Add some debugs to diagnose test failure."
This commit is contained in:
@@ -329,7 +329,8 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
|
|||||||
+ "; sleeping 1s before trying again");
|
+ "; sleeping 1s before trying again");
|
||||||
SystemClock.sleep(SECOND_IN_MS);
|
SystemClock.sleep(SECOND_IN_MS);
|
||||||
}
|
}
|
||||||
fail("App2 is not on background state after " + maxTries + " attempts: " + state );
|
fail("App2 (" + mUid + ") is not on background state after "
|
||||||
|
+ maxTries + " attempts: " + state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void assertForegroundState() throws Exception {
|
protected final void assertForegroundState() throws Exception {
|
||||||
@@ -347,7 +348,8 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
|
|||||||
turnScreenOn();
|
turnScreenOn();
|
||||||
SystemClock.sleep(SECOND_IN_MS);
|
SystemClock.sleep(SECOND_IN_MS);
|
||||||
}
|
}
|
||||||
fail("App2 is not on foreground state after " + maxTries + " attempts: " + state );
|
fail("App2 (" + mUid + ") is not on foreground state after "
|
||||||
|
+ maxTries + " attempts: " + state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void assertForegroundServiceState() throws Exception {
|
protected final void assertForegroundServiceState() throws Exception {
|
||||||
@@ -364,7 +366,8 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
|
|||||||
+ "; sleeping 1s before trying again");
|
+ "; sleeping 1s before trying again");
|
||||||
SystemClock.sleep(SECOND_IN_MS);
|
SystemClock.sleep(SECOND_IN_MS);
|
||||||
}
|
}
|
||||||
fail("App2 is not on foreground service state after " + maxTries + " attempts: " + state );
|
fail("App2 (" + mUid + ") is not on foreground service state after "
|
||||||
|
+ maxTries + " attempts: " + state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -406,8 +409,8 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
|
|||||||
// Exponential back-off.
|
// Exponential back-off.
|
||||||
timeoutMs = Math.min(timeoutMs*2, NETWORK_TIMEOUT_MS);
|
timeoutMs = Math.min(timeoutMs*2, NETWORK_TIMEOUT_MS);
|
||||||
}
|
}
|
||||||
fail("Invalid state for expectAvailable=" + expectAvailable + " after " + maxTries
|
fail("Invalid state for " + mUid + "; expectAvailable=" + expectAvailable + " after "
|
||||||
+ " attempts.\nLast error: " + error);
|
+ maxTries + " attempts.\nLast error: " + error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -763,7 +766,7 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
|
|||||||
Log.v(TAG, "app2 receiver is not ready yet; sleeping 1s before polling again");
|
Log.v(TAG, "app2 receiver is not ready yet; sleeping 1s before polling again");
|
||||||
SystemClock.sleep(SECOND_IN_MS);
|
SystemClock.sleep(SECOND_IN_MS);
|
||||||
}
|
}
|
||||||
fail("app2 receiver is not ready");
|
fail("app2 receiver is not ready in " + mUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerNetworkCallback(final NetworkRequest request, INetworkCallback cb)
|
protected void registerNetworkCallback(final NetworkRequest request, INetworkCallback cb)
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public class DumpOnFailureRule extends OnFailureRule {
|
|||||||
"dumpsys network_management",
|
"dumpsys network_management",
|
||||||
"dumpsys usagestats " + TEST_PKG + " " + TEST_APP2_PKG,
|
"dumpsys usagestats " + TEST_PKG + " " + TEST_APP2_PKG,
|
||||||
"dumpsys usagestats appstandby",
|
"dumpsys usagestats appstandby",
|
||||||
|
"dumpsys netd trafficcontroller",
|
||||||
}) {
|
}) {
|
||||||
dumpCommandOutput(out, cmd);
|
dumpCommandOutput(out, cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user