@@ -266,6 +266,10 @@ TEST_F(FirebaseRemoteConfigTest, TestSetDefault) {
266266TEST_F (FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) {
267267 ASSERT_NE (rc_, nullptr );
268268
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__)
269273 // Check if the config has default values. If not, we have cached data
270274 // from a previous test run, and auto-fetch will not happen.
271275 EXPECT_TRUE (WaitForCompletion (SetDefaults (rc_), " SetDefaults" ));
@@ -302,6 +306,7 @@ TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) {
302306 firebase::remote_config::RemoteConfigError) {});
303307#else
304308 auto config_update_promise = std::make_shared<std::promise<void > >();
309+ auto config_update_future = config_update_promise->get_future ();
305310
306311 firebase::remote_config::ConfigUpdateListenerRegistration registration =
307312 rc_->AddOnConfigUpdateListener (
@@ -312,9 +317,8 @@ TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) {
312317 config_update_promise->set_value ();
313318 });
314319 if (!has_cached_data) {
315- auto config_update_future = config_update_promise->get_future ();
316320 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 )));
318322
319323 // On Android WaitForCompletion must be called from the main thread,
320324 // so Activate is called here outside of the listener.
@@ -324,15 +328,19 @@ TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) {
324328 std::map<std::string, firebase::Variant> key_values = rc_->GetAll ();
325329 EXPECT_EQ (key_values.size (), 6 );
326330
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 ];
330334 EXPECT_EQ (k_value.type (), fetched_value.type ());
331335 EXPECT_EQ (k_value, fetched_value);
332336 }
333337 registration.Remove ();
334338 }
335339#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__)
336344}
337345
338346TEST_F (FirebaseRemoteConfigTest, TestRemoveConfigUpdateListener) {
@@ -377,9 +385,9 @@ TEST_F(FirebaseRemoteConfigTest, TestGetAll) {
377385 std::map<std::string, firebase::Variant> key_values = rc_->GetAll ();
378386 EXPECT_EQ (key_values.size (), 6 );
379387
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 ];
383391 EXPECT_EQ (k_value.type (), fetched_value.type ());
384392 EXPECT_EQ (k_value, fetched_value);
385393 }
0 commit comments