From 0a607203fd667a6cccd2fc25b4564efe54dbc016 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 15 Nov 2021 19:31:10 +0100 Subject: [PATCH] [Kotlin] Use new counter metric in ping type tests This should make them compile and pass. --- .../telemetry/glean/private/PingTypeTest.kt | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/PingTypeTest.kt b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/PingTypeTest.kt index 544d53f5b..8b8b4606a 100644 --- a/glean-core/android/src/test/java/mozilla/telemetry/glean/private/PingTypeTest.kt +++ b/glean-core/android/src/test/java/mozilla/telemetry/glean/private/PingTypeTest.kt @@ -27,6 +27,9 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import java.util.concurrent.TimeUnit +import mozilla.telemetry.glean.internal.CounterMetric as CounterMetricType +import mozilla.telemetry.glean.internal.CommonMetricData +import mozilla.telemetry.glean.internal.Lifetime @RunWith(AndroidJUnit4::class) class PingTypeTest { @@ -51,13 +54,13 @@ class PingTypeTest { reasonCodes = listOf() ) - val counter = CounterMetricType( + val counter = CounterMetricType(CommonMetricData( disabled = false, category = "test", - lifetime = Lifetime.Ping, + lifetime = Lifetime.PING, name = "counter", sendInPings = listOf("custom") - ) + )) counter.add() assertTrue(counter.testHasValue()) @@ -101,13 +104,13 @@ class PingTypeTest { reasonCodes = listOf() ) - val counter = CounterMetricType( + val counter = CounterMetricType(CommonMetricData( disabled = false, category = "test", - lifetime = Lifetime.Ping, + lifetime = Lifetime.PING, name = "counter", sendInPings = listOf("custom_ping") - ) + )) counter.add() assertTrue(counter.testHasValue()) @@ -142,13 +145,13 @@ class PingTypeTest { reasonCodes = listOf() ) - val counter = CounterMetricType( + val counter = CounterMetricType(CommonMetricData( disabled = false, category = "test", - lifetime = Lifetime.Ping, + lifetime = Lifetime.PING, name = "counter", sendInPings = listOf("custom-ping") - ) + )) counter.add() assertTrue(counter.testHasValue()) @@ -183,13 +186,13 @@ class PingTypeTest { reasonCodes = listOf() ) - val counter = CounterMetricType( + val counter = CounterMetricType(CommonMetricData( disabled = false, category = "test", - lifetime = Lifetime.Ping, + lifetime = Lifetime.PING, name = "counter", sendInPings = listOf("custom") - ) + )) counter.add() assertTrue(counter.testHasValue()) @@ -211,13 +214,13 @@ class PingTypeTest { fun `Sending a ping with an unknown name is a no-op`() { val server = getMockWebServer() - val counter = CounterMetricType( + val counter = CounterMetricType(CommonMetricData( disabled = false, category = "test", - lifetime = Lifetime.Ping, + lifetime = Lifetime.PING, name = "counter", sendInPings = listOf("unknown") - ) + )) val context = getContext() delayMetricsPing(context)