@@ -366,4 +366,44 @@ TEST_F(FirebaseRemoteConfigTest, TestFetchInterval) {
366
366
EXPECT_NE (current_fetch_time, rc_->GetInfo ().fetch_time );
367
367
}
368
368
369
+ TEST_F (FirebaseRemoteConfigTest, TestFetchSecondsParameter) {
370
+ ASSERT_NE (rc_, nullptr );
371
+
372
+ EXPECT_TRUE (
373
+ WaitForCompletion (RunWithRetry ([&]() { return rc_->FetchAndActivate (); }),
374
+ " FetchAndActivate" ));
375
+ uint64_t current_fetch_time = rc_->GetInfo ().fetch_time ;
376
+ // Making sure the config settings's fetch interval is 12 hours
377
+ EXPECT_TRUE (WaitForCompletion (SetDefaultConfigSettings (rc_),
378
+ " SetDefaultConfigSettings" ));
379
+ // Test Fetch() without specifying an interval; it should not fetch.
380
+ EXPECT_TRUE (WaitForCompletion (RunWithRetry ([&]() { return rc_->Fetch (); }),
381
+ " Fetch() [should not fetch]" ));
382
+ EXPECT_EQ (current_fetch_time, rc_->GetInfo ().fetch_time );
383
+
384
+ FLAKY_TEST_SECTION_BEGIN ();
385
+
386
+ // Call Fetch(0), forcing a fetch.
387
+ EXPECT_TRUE (WaitForCompletion (RunWithRetry ([&]() { return rc_->Fetch (0 ); }),
388
+ " Fetch(0) [should fetch]" ));
389
+ EXPECT_NE (current_fetch_time, rc_->GetInfo ().fetch_time );
390
+
391
+ current_fetch_time = rc_->GetInfo ().fetch_time ;
392
+ // Call Fetch(30), which shouldn't fetch yet.
393
+ EXPECT_TRUE (WaitForCompletion (RunWithRetry ([&]() { return rc_->Fetch (30 ); }),
394
+ " Fetch(30) [should not fetch]" ));
395
+ EXPECT_EQ (current_fetch_time, rc_->GetInfo ().fetch_time );
396
+
397
+ LogDebug (" Pausing 45 seconds before re-running Fetch" );
398
+ for (int i = 0 ; i < 45 ; i++) {
399
+ ProcessEvents (1000 );
400
+ }
401
+ // After waiting 45 seconds, Fetch(30) should now fetch.
402
+ EXPECT_TRUE (WaitForCompletion (RunWithRetry ([&]() { return rc_->Fetch (30 ); }),
403
+ " Fetch(30) [should fetch]" ));
404
+ EXPECT_NE (current_fetch_time, rc_->GetInfo ().fetch_time );
405
+
406
+ FLAKY_TEST_SECTION_END ();
407
+ }
408
+
369
409
} // namespace firebase_testapp_automated
0 commit comments