@@ -266,6 +266,10 @@ TEST_F(FirebaseRemoteConfigTest, TestSetDefault) {
266
266
TEST_F (FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) {
267
267
ASSERT_NE (rc_, nullptr );
268
268
269
+ // This test sometimes times out on Android with the config not updated.
270
+ #if defined(__ANDROID__)
271
+ FLAKY_TEST_SECTION_BEGIN ();
272
+ #endif // defined(__ANDROID__)
269
273
// Check if the config has default values. If not, we have cached data
270
274
// from a previous test run, and auto-fetch will not happen.
271
275
EXPECT_TRUE (WaitForCompletion (SetDefaults (rc_), " SetDefaults" ));
@@ -302,6 +306,7 @@ TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) {
302
306
firebase::remote_config::RemoteConfigError) {});
303
307
#else
304
308
auto config_update_promise = std::make_shared<std::promise<void > >();
309
+ auto config_update_future = config_update_promise->get_future ();
305
310
306
311
firebase::remote_config::ConfigUpdateListenerRegistration registration =
307
312
rc_->AddOnConfigUpdateListener (
@@ -312,9 +317,8 @@ TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) {
312
317
config_update_promise->set_value ();
313
318
});
314
319
if (!has_cached_data) {
315
- auto config_update_future = config_update_promise->get_future ();
316
320
ASSERT_EQ (std::future_status::ready,
317
- config_update_future.wait_for (std::chrono::milliseconds (30000 )));
321
+ config_update_future.wait_for (std::chrono::milliseconds (20000 )));
318
322
319
323
// On Android WaitForCompletion must be called from the main thread,
320
324
// so Activate is called here outside of the listener.
@@ -324,15 +328,19 @@ TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) {
324
328
std::map<std::string, firebase::Variant> key_values = rc_->GetAll ();
325
329
EXPECT_EQ (key_values.size (), 6 );
326
330
327
- for (auto key_valur_pair : kServerValue ) {
328
- firebase::Variant k_value = key_valur_pair .value ;
329
- firebase::Variant fetched_value = key_values[key_valur_pair .key ];
331
+ for (auto key_value_pair : kServerValue ) {
332
+ firebase::Variant k_value = key_value_pair .value ;
333
+ firebase::Variant fetched_value = key_values[key_value_pair .key ];
330
334
EXPECT_EQ (k_value.type (), fetched_value.type ());
331
335
EXPECT_EQ (k_value, fetched_value);
332
336
}
333
337
registration.Remove ();
334
338
}
335
339
#endif // !FIREBASE_PLATFORM_DESKTOP
340
+ // This test sometimes times out on Android with the config not updated.
341
+ #if defined(__ANDROID__)
342
+ FLAKY_TEST_SECTION_END ();
343
+ #endif // defined(__ANDROID__)
336
344
}
337
345
338
346
TEST_F (FirebaseRemoteConfigTest, TestRemoveConfigUpdateListener) {
@@ -377,9 +385,9 @@ TEST_F(FirebaseRemoteConfigTest, TestGetAll) {
377
385
std::map<std::string, firebase::Variant> key_values = rc_->GetAll ();
378
386
EXPECT_EQ (key_values.size (), 6 );
379
387
380
- for (auto key_valur_pair : kServerValue ) {
381
- firebase::Variant k_value = key_valur_pair .value ;
382
- firebase::Variant fetched_value = key_values[key_valur_pair .key ];
388
+ for (auto key_value_pair : kServerValue ) {
389
+ firebase::Variant k_value = key_value_pair .value ;
390
+ firebase::Variant fetched_value = key_values[key_value_pair .key ];
383
391
EXPECT_EQ (k_value.type (), fetched_value.type ());
384
392
EXPECT_EQ (k_value, fetched_value);
385
393
}
0 commit comments