@@ -768,6 +768,20 @@ public void getInfo_hitsThrottleLimit_throttledStatus() throws Exception {
768768 .isEqualTo (firstFetchedContainer .getFetchTime ());
769769 }
770770
771+ @ Test
772+ public void customSignals_updated_onSubsequentFetch () throws Exception {
773+ Map <String , String > customSignals =
774+ ImmutableMap .of (
775+ "subscription" , "premium" ,
776+ "age" , "20" );
777+ sharedPrefsClient .setCustomSignals (customSignals );
778+ fetchCallToHttpClientUpdatesClockAndReturnsConfig (firstFetchedContainer );
779+
780+ assertWithMessage ("Fetch() failed!" ).that (fetchHandler .fetch ().isSuccessful ()).isTrue ();
781+
782+ verifyCustomSignals (customSignals );
783+ }
784+
771785 private ConfigFetchHandler getNewFetchHandler (AnalyticsConnector analyticsConnector ) {
772786 ConfigFetchHandler fetchHandler =
773787 spy (
@@ -972,6 +986,21 @@ private void verifyETags(@Nullable String requestETag, String responseETag) thro
972986 assertThat (sharedPrefsClient .getLastFetchETag ()).isEqualTo (responseETag );
973987 }
974988
989+ private void verifyCustomSignals (Map <String , String > customSignals ) throws Exception {
990+ verify (mockBackendFetchApiClient )
991+ .fetch (
992+ any (HttpURLConnection .class ),
993+ /* instanceId= */ any (),
994+ /* instanceIdToken= */ any (),
995+ /* analyticsUserProperties= */ any (),
996+ /* lastFetchETag= */ any (),
997+ /* customHeaders= */ any (),
998+ /* firstOpenTime= */ any (),
999+ /* currentTime= */ any (),
1000+ /* customSignals= */ eq (customSignals ));
1001+ assertThat (sharedPrefsClient .getCustomSignals ()).isEqualTo (customSignals );
1002+ }
1003+
9751004 private void loadBackendApiClient () throws Exception {
9761005 when (mockBackendFetchApiClient .createHttpURLConnection ())
9771006 .thenReturn (new FakeHttpURLConnection (new URL ("https://firebase.google.com" )));
0 commit comments