From 789a377c6bbca8a9077a8290218868e2126d0596 Mon Sep 17 00:00:00 2001 From: Jon Simantov Date: Fri, 29 Jan 2021 11:45:52 -0800 Subject: [PATCH] Add a workaround for an AdMob race condition to integration test. 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.");