@@ -113,31 +113,31 @@ TEST_F(FirebaseAnalyticsTest, TestGetSessionID) {
113
113
#if defined(__ANDROID__)
114
114
if (did_test_setconsent_) {
115
115
LogInfo (
116
- " Skipping TestGetSessionID after TestSetConsent, as it will fail until "
117
- " the app is restarted." );
116
+ " Skipping TestGetSessionID after TestSetConsent, as GetSessionId() "
117
+ " will fail until the app is restarted." );
118
118
GTEST_SKIP ();
119
119
return ;
120
120
}
121
121
#endif
122
122
firebase::Future<int64_t > future;
123
123
124
- // It can take Analytics a moment to initialize on iOS.
125
- // So on iOS/tvOS, retry this test if GetSessionId returns an
126
- // error.
127
- #if TARGET_OS_IPHONE
124
+ // Give Analytics a moment to initialize and create a session.
125
+ ProcessEvents (1000 );
126
+
127
+ // It can take Analytics even more time to initialize and create a session, so
128
+ // retry GetSessionId() if it returns an error.
128
129
FLAKY_TEST_SECTION_BEGIN ();
129
- #endif // TARGET_OS_IPHONE
130
130
131
131
future = firebase::analytics::GetSessionId ();
132
132
WaitForCompletion (future, " GetSessionId" );
133
133
134
- #if TARGET_OS_IPHONE
135
134
FLAKY_TEST_SECTION_END ();
136
- #endif // TARGET_OS_IPHONE
137
135
138
136
EXPECT_TRUE (future.result () != nullptr );
139
137
EXPECT_NE (*future.result (), static_cast <int64_t >(0L ));
140
- LogInfo (" Got session ID: %" PRId64, *future.result ());
138
+ if (future.result () != nullptr ) {
139
+ LogInfo (" Got session ID: %" PRId64, *future.result ());
140
+ }
141
141
}
142
142
143
143
TEST_F (FirebaseAnalyticsTest, TestSetConsent) {
0 commit comments