diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /netwerk/test/gtest/TestHttpAtom.cpp | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/test/gtest/TestHttpAtom.cpp')
-rw-r--r-- | netwerk/test/gtest/TestHttpAtom.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/netwerk/test/gtest/TestHttpAtom.cpp b/netwerk/test/gtest/TestHttpAtom.cpp new file mode 100644 index 0000000000..917210a2c4 --- /dev/null +++ b/netwerk/test/gtest/TestHttpAtom.cpp @@ -0,0 +1,39 @@ +#include "gtest/gtest.h" + +#include "nsHttp.h" + +TEST(TestHttpAtom, AtomComparison) +{ + mozilla::net::nsHttpAtom atom(mozilla::net::nsHttp::Host); + mozilla::net::nsHttpAtom same_atom(mozilla::net::nsHttp::Host); + mozilla::net::nsHttpAtom different_atom(mozilla::net::nsHttp::Accept); + + ASSERT_EQ(atom, atom); + ASSERT_EQ(atom, mozilla::net::nsHttp::Host); + ASSERT_EQ(mozilla::net::nsHttp::Host, atom); + ASSERT_EQ(atom, same_atom); + ASSERT_EQ(atom.get(), same_atom.get()); + ASSERT_EQ(atom.get(), mozilla::net::nsHttp::Host.get()); + + ASSERT_NE(atom, different_atom); + ASSERT_NE(atom.get(), different_atom.get()); +} + +TEST(TestHttpAtom, LiteralComparison) +{ + ASSERT_EQ(mozilla::net::nsHttp::Host, mozilla::net::nsHttp::Host); + ASSERT_NE(mozilla::net::nsHttp::Host, mozilla::net::nsHttp::Accept); + + ASSERT_EQ(mozilla::net::nsHttp::Host.get(), mozilla::net::nsHttp::Host.get()); + ASSERT_NE(mozilla::net::nsHttp::Host.get(), + mozilla::net::nsHttp::Accept.get()); +} + +TEST(TestHttpAtom, Validity) +{ + mozilla::net::nsHttpAtom atom(mozilla::net::nsHttp::Host); + ASSERT_TRUE(atom); + + mozilla::net::nsHttpAtom atom_empty; + ASSERT_FALSE(atom_empty); +} |