зеркало из https://github.com/mozilla/glean.git
Merge pull request #853 from Dexterp37/java_submit
Allow calling `PingType.submit()` from Java without parameters
This commit is contained in:
Коммит
63ca90fc0c
|
@ -1,5 +1,8 @@
|
|||
# Unreleased changes
|
||||
|
||||
* Android
|
||||
* The `PingType.submit()` can now be called without a `null` by Java consumers.
|
||||
|
||||
[Full changelog](https://github.com/mozilla/glean/compare/v28.0.0...master)
|
||||
|
||||
# v28.0.0 (2020-04-23)
|
||||
|
|
|
@ -72,6 +72,7 @@ class PingType<ReasonCodesEnum : Enum<ReasonCodesEnum>> (
|
|||
*
|
||||
* @param reason The reason the ping is being submitted.
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun submit(reason: ReasonCodesEnum? = null) {
|
||||
val reasonString = reason?.let { this.reasonCodes[it.ordinal] }
|
||||
Glean.submitPing(this, reasonString)
|
||||
|
|
|
@ -16,6 +16,8 @@ import org.robolectric.RobolectricTestRunner;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mozilla.telemetry.glean.GleanMetrics.GleanInternalMetrics;
|
||||
import mozilla.telemetry.glean.GleanMetrics.Pings;
|
||||
import mozilla.telemetry.glean.config.Configuration;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
|
@ -66,4 +68,12 @@ public class GleanFromJavaTest {
|
|||
// visibility is `internal`, but looks like Java ignores it.
|
||||
GleanTimerId testId = new GleanTimerId(100);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCanSendPing() {
|
||||
// submit() can be called without parameters.
|
||||
Pings.INSTANCE.baseline().submit();
|
||||
// submit() can be called with a `reason`.
|
||||
Pings.INSTANCE.baseline().submit(Pings.baselineReasonCodes.background);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче