Loading components/service/glean/src/main/java/mozilla/components/service/glean/error/ErrorRecording.kt +5 −1 Original line number Diff line number Diff line Loading @@ -122,6 +122,10 @@ object ErrorRecording { sendInPings = metricData.sendInPings ) if (!errorMetric.testHasValue(usePingName)) { return 0 } else { return errorMetric.testGetValue(usePingName) } } } components/service/glean/src/main/java/mozilla/components/service/glean/storages/StringListsStorageEngine.kt +0 −11 Original line number Diff line number Diff line Loading @@ -133,17 +133,6 @@ internal open class StringListsStorageEngineImplementation( it.take(MAX_STRING_LENGTH) } // Record an error when attempting to record a zero-length list and return. if (stringList.count() == 0) { recordError( metricData, ErrorType.InvalidValue, "Attempt to set() an empty string list to ${metricData.identifier}", logger ) return } if (stringList.count() > MAX_LIST_LENGTH_VALUE) { recordError( metricData, Loading components/service/glean/src/test/java/mozilla/components/service/glean/storages/StringListsStorageEngineTest.kt +4 −8 Original line number Diff line number Diff line Loading @@ -203,7 +203,7 @@ class StringListsStorageEngineTest { } @Test fun `set() records an error and returns when passed an empty list`() { fun `set() doesn't record an error when passed an empty list`() { val metric = StringListMetricType( disabled = false, category = "telemetry", Loading @@ -214,14 +214,10 @@ class StringListsStorageEngineTest { StringListsStorageEngine.set(metricData = metric, value = listOf()) // If nothing was stored, then the snapshot should be null val snapshot = StringListsStorageEngine.getSnapshot( storeName = "store1", clearStore = false) assertNull("Empty list must not be stored", snapshot) assertEquals(listOf<String>(), metric.testGetValue()) // Verify the error was recorded assertEquals(1, testGetNumRecordedErrors(metric, ErrorType.InvalidValue)) // Verify the error was not recorded assertEquals(0, testGetNumRecordedErrors(metric, ErrorType.InvalidValue)) } @Test Loading Loading
components/service/glean/src/main/java/mozilla/components/service/glean/error/ErrorRecording.kt +5 −1 Original line number Diff line number Diff line Loading @@ -122,6 +122,10 @@ object ErrorRecording { sendInPings = metricData.sendInPings ) if (!errorMetric.testHasValue(usePingName)) { return 0 } else { return errorMetric.testGetValue(usePingName) } } }
components/service/glean/src/main/java/mozilla/components/service/glean/storages/StringListsStorageEngine.kt +0 −11 Original line number Diff line number Diff line Loading @@ -133,17 +133,6 @@ internal open class StringListsStorageEngineImplementation( it.take(MAX_STRING_LENGTH) } // Record an error when attempting to record a zero-length list and return. if (stringList.count() == 0) { recordError( metricData, ErrorType.InvalidValue, "Attempt to set() an empty string list to ${metricData.identifier}", logger ) return } if (stringList.count() > MAX_LIST_LENGTH_VALUE) { recordError( metricData, Loading
components/service/glean/src/test/java/mozilla/components/service/glean/storages/StringListsStorageEngineTest.kt +4 −8 Original line number Diff line number Diff line Loading @@ -203,7 +203,7 @@ class StringListsStorageEngineTest { } @Test fun `set() records an error and returns when passed an empty list`() { fun `set() doesn't record an error when passed an empty list`() { val metric = StringListMetricType( disabled = false, category = "telemetry", Loading @@ -214,14 +214,10 @@ class StringListsStorageEngineTest { StringListsStorageEngine.set(metricData = metric, value = listOf()) // If nothing was stored, then the snapshot should be null val snapshot = StringListsStorageEngine.getSnapshot( storeName = "store1", clearStore = false) assertNull("Empty list must not be stored", snapshot) assertEquals(listOf<String>(), metric.testGetValue()) // Verify the error was recorded assertEquals(1, testGetNumRecordedErrors(metric, ErrorType.InvalidValue)) // Verify the error was not recorded assertEquals(0, testGetNumRecordedErrors(metric, ErrorType.InvalidValue)) } @Test Loading