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() {
105
105
106
106
// Create and Initialize Firelog service components
107
107
context = ApplicationProvider .getApplicationContext ();
108
+
109
+ // Reset sharedpreferences for bigquery delivery metrics export before every test.
110
+ resetPreferencesField (DELIVERY_METRICS_EXPORT_TO_BIG_QUERY_PREF );
108
111
}
109
112
110
113
/** If the developer didn't include Analytics and Firelog, we should not crash. */
@@ -331,6 +334,13 @@ public void testShouldExportDeliveryMetricsToBigQuery_falseManifestTrueSetter()
331
334
assertPreferencesFieldWithValue (DELIVERY_METRICS_EXPORT_TO_BIG_QUERY_PREF , true );
332
335
}
333
336
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
+
334
344
private void assertPreferencesFieldWithValue (String field , Boolean expectedValue ) {
335
345
SharedPreferences preferences =
336
346
context .getSharedPreferences (FCM_PREFERENCES , Context .MODE_PRIVATE );
You can’t perform that action at this time.
0 commit comments