Skip to content

Commit 42496c4

Browse files
authored
Add retry to LoadConsentForm for timeouts. (#1480)
* Add retry to LoadConsentForm for timeouts. * Update test to allow timed out error through completion.
1 parent 3a28fa3 commit 42496c4

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

gma/integration_test/src/integration_test.cc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2660,15 +2660,24 @@ TEST_F(FirebaseGmaUmpTest, TestUmpLoadForm) {
26602660
EXPECT_EQ(consent_info_->GetConsentFormStatus(),
26612661
firebase::gma::ump::kConsentFormStatusAvailable);
26622662

2663-
// Load the form.
2664-
firebase::Future<void> future = consent_info_->LoadConsentForm();
2663+
// Load the form. Run this step with retry in case of network timeout.
2664+
WaitForCompletionAnyResult(
2665+
RunWithRetry([&]() { return consent_info_->LoadConsentForm(); }),
2666+
"LoadConsentForm");
26652667

2666-
EXPECT_TRUE(future == consent_info_->LoadConsentFormLastResult());
2668+
firebase::Future<void> future = consent_info_->LoadConsentFormLastResult();
26672669

2668-
WaitForCompletion(future, "LoadConsentForm");
2670+
// If it still timed out after all the retries, let the test pass.
2671+
EXPECT_THAT(future.error(),
2672+
AnyOf(firebase::gma::ump::kConsentFormSuccess,
2673+
firebase::gma::ump::kConsentFormErrorTimeout));
26692674

26702675
EXPECT_EQ(consent_info_->GetConsentFormStatus(),
26712676
firebase::gma::ump::kConsentFormStatusAvailable);
2677+
2678+
if (future.error() == firebase::gma::ump::kConsentFormErrorTimeout) {
2679+
LogWarning("Timed out after multiple tries, but passing anyway.");
2680+
}
26722681
}
26732682

26742683
TEST_F(FirebaseGmaUmpTest, TestUmpShowForm) {

0 commit comments

Comments
 (0)