Make the CA cert management test more permissive
Let the test wait for 15 seconds for a CA certificate to be installed
rather than 5.
Bug: 135975295
Test: atest com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testCaCertManagement
Change-Id: I6244345e9f1aece268d249f419d00ecd5097c78c
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/CaCertManagementTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/CaCertManagementTest.java
index 11c1507..2e5f479 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/CaCertManagementTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/CaCertManagementTest.java
@@ -36,10 +36,6 @@
import static com.android.compatibility.common.util.FakeKeys.FAKE_RSA_1;
public class CaCertManagementTest extends BaseDeviceAdminTest {
- // Maximal number of times to check whether a certificate is in the accepted
- // issuers list before declaring test failure.
- private static final int MAX_IS_TRUSTED_CHECKS = 50;
-
private final ComponentName mAdmin = ADMIN_RECEIVER_COMPONENT;
/**
@@ -154,11 +150,15 @@
X509TrustManager tm = getFirstX509TrustManager(tmf);
boolean trusted = Arrays.asList(tm.getAcceptedIssuers()).contains(caCert);
+ // Maximal time to wait until the certificate is found to be in the accepted
+ // issuers list before declaring test failure.
+ final int maxWaitForCertificateTrustedSec = 15;
+
// All three responses should match - if an installed certificate isn't trusted or (worse)
// a trusted certificate isn't even installed we should fail now, loudly.
assertEquals(installed, listed);
int numTries = 0;
- while (numTries < MAX_IS_TRUSTED_CHECKS && (installed != trusted)) {
+ while (numTries < (maxWaitForCertificateTrustedSec * 10) && (installed != trusted)) {
try {
Thread.sleep(100);
trusted = Arrays.asList(tm.getAcceptedIssuers()).contains(caCert);