From 66be026b80195c29fa051a4a3cb4ae3ee5181b37 Mon Sep 17 00:00:00 2001 From: jonsimantov Date: Fri, 29 Jan 2021 13:38:45 -0800 Subject: [PATCH] Add a workaround for an AdMob race condition to integration test. (#263) The AdMob SDK crashes if you call Initialize and Terminate too quickly on a non-main thread. This happens in the integration test when skipping the interactive tests (e.g. when running on FTL). --- admob/integration_test/src/integration_test.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/admob/integration_test/src/integration_test.cc b/admob/integration_test/src/integration_test.cc index 26040d32d8..eb994d8e16 100644 --- a/admob/integration_test/src/integration_test.cc +++ b/admob/integration_test/src/integration_test.cc @@ -123,6 +123,11 @@ void FirebaseAdMobTest::SetUpTestSuite() { } void FirebaseAdMobTest::TearDownTestSuite() { + // Workaround: AdMob does some of its initialization in the main + // thread, so if you terminate it too quickly after initialization + // it can cause issues. Add a small delay here in case most of the + // tests are skipped. + ProcessEvents(1000); LogDebug("Shutdown AdMob."); firebase::admob::Terminate(); LogDebug("Shutdown Firebase App.");