diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /toolkit/components/glean/tests | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/glean/tests')
-rw-r--r-- | toolkit/components/glean/tests/gtest/TestFog.cpp | 11 |
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) |