@@ -341,4 +341,50 @@ TEST_F(FirebaseAnalyticsTest, TestSetConsent) {
341
341
did_test_setconsent_ = true ;
342
342
}
343
343
344
+ // Test that it compiles and runs on all platforms.
345
+ TEST_F (FirebaseAnalyticsTest, TestSetDefaultEventParameters) {
346
+ LogDebug (" Testing SetDefaultEventParameters()." );
347
+
348
+ // Set some default parameters.
349
+ std::map<std::string, Variant> defaults;
350
+ defaults[" default_int" ] = 123 ;
351
+ defaults[" default_string" ] = " default_value" ;
352
+ firebase::analytics::SetDefaultEventParameters (defaults);
353
+
354
+ // Log an event - the defaults should be included automatically by the
355
+ // underlying SDK if logging immediately after setting is supported.
356
+ // Verification might need manual checking in the Analytics console or
357
+ // via platform-specific debug logs if possible.
358
+ firebase::analytics::LogEvent (" event_with_defaults" );
359
+ LogDebug (" Logged event_with_defaults" );
360
+
361
+ // Clear one default parameter by setting it to null.
362
+ defaults[" default_int" ] = Variant::Null ();
363
+ firebase::analytics::SetDefaultEventParameters (defaults);
364
+
365
+ // Log another event.
366
+ firebase::analytics::LogEvent (" event_with_one_default_cleared" );
367
+ LogDebug (" Logged event_with_one_default_cleared" );
368
+
369
+ // Set only one parameter, clearing others implicitly if underlying SDK works
370
+ // like that
371
+ std::map<std::string, Variant> single_default;
372
+ single_default[" only_this" ] = 45.6 ;
373
+ firebase::analytics::SetDefaultEventParameters (single_default);
374
+ firebase::analytics::LogEvent (" event_with_only_one_default" );
375
+ LogDebug (" Logged event_with_only_one_default" );
376
+
377
+ // Clear all defaults by passing an empty map.
378
+ std::map<std::string, Variant> empty_defaults;
379
+ firebase::analytics::SetDefaultEventParameters (empty_defaults);
380
+
381
+ // Log an event with no defaults.
382
+ firebase::analytics::LogEvent (" event_with_no_defaults" );
383
+ LogDebug (" Logged event_with_no_defaults" );
384
+
385
+ // If we reach here without crashing, consider the basic test passed for the
386
+ // C++ layer. Deeper verification requires platform tools.
387
+ LogDebug (" SetDefaultEventParameters() tests completed." );
388
+ }
389
+
344
390
} // namespace firebase_testapp_automated
0 commit comments