File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
firebase-messaging/src/test/java/com/google/firebase/messaging Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,9 @@ public void setUp() {
105105
106106 // Create and Initialize Firelog service components
107107 context = ApplicationProvider .getApplicationContext ();
108+
109+ // Reset sharedpreferences for bigquery delivery metrics export before every test.
110+ resetPreferencesField (DELIVERY_METRICS_EXPORT_TO_BIG_QUERY_PREF );
108111 }
109112
110113 /** If the developer didn't include Analytics and Firelog, we should not crash. */
@@ -331,6 +334,13 @@ public void testShouldExportDeliveryMetricsToBigQuery_falseManifestTrueSetter()
331334 assertPreferencesFieldWithValue (DELIVERY_METRICS_EXPORT_TO_BIG_QUERY_PREF , true );
332335 }
333336
337+ private void resetPreferencesField (String field ) {
338+ SharedPreferences preferences =
339+ context .getSharedPreferences (FCM_PREFERENCES , Context .MODE_PRIVATE );
340+
341+ preferences .edit ().remove (field ).apply ();
342+ }
343+
334344 private void assertPreferencesFieldWithValue (String field , Boolean expectedValue ) {
335345 SharedPreferences preferences =
336346 context .getSharedPreferences (FCM_PREFERENCES , Context .MODE_PRIVATE );
You can’t perform that action at this time.
0 commit comments