Skip to content

Commit ea5dfe1

Browse files
committed
Add integration test
1 parent 5efbc2b commit ea5dfe1

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

analytics/integration_test/src/integration_test.cc

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,4 +341,50 @@ TEST_F(FirebaseAnalyticsTest, TestSetConsent) {
341341
did_test_setconsent_ = true;
342342
}
343343

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+
344390
} // namespace firebase_testapp_automated

0 commit comments

Comments
 (0)