summaryrefslogtreecommitdiffstats
path: root/toolkit/components/glean/tests/gtest
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/glean/tests/gtest')
-rw-r--r--toolkit/components/glean/tests/gtest/TestFog.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/toolkit/components/glean/tests/gtest/TestFog.cpp b/toolkit/components/glean/tests/gtest/TestFog.cpp
index 0c1621911e..e6f4f7a2c2 100644
--- a/toolkit/components/glean/tests/gtest/TestFog.cpp
+++ b/toolkit/components/glean/tests/gtest/TestFog.cpp
@@ -11,6 +11,7 @@
#include "mozilla/Maybe.h"
#include "mozilla/Result.h"
#include "mozilla/ResultVariant.h"
+#include "mozilla/TimeStamp.h"
#include "nsTArray.h"
@@ -20,6 +21,7 @@
#include "prtime.h"
using mozilla::Preferences;
+using mozilla::TimeDuration;
using namespace mozilla::glean;
using namespace mozilla::glean::impl;
@@ -277,6 +279,15 @@ TEST_F(FOGFixture, TestCppTimingDistWorks) {
ASSERT_EQ(sampleCount, (uint64_t)2);
}
+TEST_F(FOGFixture, TestCppTimingDistNegativeDuration) {
+ // Intentionally a negative duration to test the error case.
+ auto negDuration = TimeDuration::FromSeconds(-1);
+ test_only::what_time_is_it.AccumulateRawDuration(negDuration);
+
+ ASSERT_EQ(mozilla::Nothing(),
+ test_only::what_time_is_it.TestGetValue().unwrap());
+}
+
TEST_F(FOGFixture, TestLabeledBooleanWorks) {
ASSERT_EQ(mozilla::Nothing(),
test_only::mabels_like_balloons.Get("hot_air"_ns)