@@ -107,18 +107,8 @@ TEST_F(FirebaseAnalyticsTest, TestGetAnalyticsInstanceID) {
107107}
108108
109109TEST_F (FirebaseAnalyticsTest, TestGetSessionID) {
110- #if defined(__ANDROID__)
111- // Android continues to have random failures on this test despite the
112- // workarounds below, so just skip it for now.
113- LogInfo (" Skipping TestGetSessionID on Android" );
114- GTEST_SKIP ();
115- return ;
116- #endif
117-
118- // Android emulator tests are currently not working due to getSessionId being
119- // disabled on virtual FTL devices, due to an older version of Google Play
120- // services.
121- SKIP_TEST_ON_ANDROID_EMULATOR;
110+ // Don't run this test if Google Play services is < 23.0.0.
111+ SKIP_TEST_ON_ANDROID_GOOGLE_PLAY_SERVICES_BELOW (230000 );
122112
123113 // iOS simulator tests are currently extra flaky, occasionally failing with an
124114 // "Analytics uninitialized" error even after multiple attempts.
@@ -128,6 +118,9 @@ TEST_F(FirebaseAnalyticsTest, TestGetSessionID) {
128118 // needs to be restarted after consent is denied or it won't generate a new
129119 // sessionID. To not break the tests, skip this test in that case.
130120#if defined(__ANDROID__)
121+ // Log the Google Play services version for debugging in case this test fails.
122+ LogInfo (" Google Play services version: %d" , GetGooglePlayServicesVersion ());
123+
131124 if (did_test_setconsent_) {
132125 LogInfo (
133126 " Skipping TestGetSessionID after TestSetConsent, as GetSessionId() "
@@ -136,6 +129,10 @@ TEST_F(FirebaseAnalyticsTest, TestGetSessionID) {
136129 return ;
137130 }
138131#endif
132+ // Log an event once, to ensure that there is currently an active Analytics
133+ // session.
134+ firebase::analytics::LogEvent (firebase::analytics::kEventSignUp );
135+
139136 firebase::Future<int64_t > future;
140137
141138 // Give Analytics a moment to initialize and create a session.
0 commit comments