Skip to content

Commit e4d850a

Browse files
committed
Add tests for adding global custom attributes on network requests.
1 parent b3e1600 commit e4d850a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

firebase-perf/src/test/java/com/google/firebase/perf/transport/TransportManagerTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ public void logTraceMetric_globalCustomAttributesAreAdded() {
11191119
}
11201120

11211121
@Test
1122-
public void logNetworkMetric_globalCustomAttributesAreNotAdded() {
1122+
public void logNetworkMetric_globalCustomAttributesAreAdded() {
11231123
FirebasePerformance.getInstance().putAttribute("test_key1", "test_value1");
11241124
FirebasePerformance.getInstance().putAttribute("test_key2", "test_value2");
11251125
NetworkRequestMetric validNetworkRequest = createValidNetworkRequestMetric();
@@ -1131,7 +1131,12 @@ public void logNetworkMetric_globalCustomAttributesAreNotAdded() {
11311131
assertThat(loggedPerfMetric.getNetworkRequestMetric()).isEqualTo(validNetworkRequest);
11321132
validateApplicationInfo(
11331133
loggedPerfMetric, ApplicationProcessState.APPLICATION_PROCESS_STATE_UNKNOWN);
1134-
assertThat(loggedPerfMetric.getApplicationInfo().getCustomAttributesCount()).isEqualTo(0);
1134+
1135+
Map<String, String> globalCustomAttributes =
1136+
loggedPerfMetric.getApplicationInfo().getCustomAttributesMap();
1137+
assertThat(globalCustomAttributes).hasSize(2);
1138+
assertThat(globalCustomAttributes).containsEntry("test_key1", "test_value1");
1139+
assertThat(globalCustomAttributes).containsEntry("test_key2", "test_value2");
11351140
}
11361141

11371142
@Test

0 commit comments

Comments
 (0)