summaryrefslogtreecommitdiffstats
path: root/dom/quota/test/gtest/TestStorageOriginAttributes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/quota/test/gtest/TestStorageOriginAttributes.cpp')
-rw-r--r--dom/quota/test/gtest/TestStorageOriginAttributes.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/dom/quota/test/gtest/TestStorageOriginAttributes.cpp b/dom/quota/test/gtest/TestStorageOriginAttributes.cpp
index 4529e1d53b..f7a8387305 100644
--- a/dom/quota/test/gtest/TestStorageOriginAttributes.cpp
+++ b/dom/quota/test/gtest/TestStorageOriginAttributes.cpp
@@ -9,6 +9,33 @@
namespace mozilla::dom::quota::test {
+TEST(DOM_Quota_StorageOriginAttributes, Constructor_Default)
+{
+ {
+ StorageOriginAttributes originAttributes;
+
+ ASSERT_FALSE(originAttributes.InIsolatedMozBrowser());
+ ASSERT_EQ(originAttributes.UserContextId(), 0u);
+ }
+}
+
+TEST(DOM_Quota_StorageOriginAttributes, Constructor_InIsolatedMozbrowser)
+{
+ {
+ StorageOriginAttributes originAttributes(/* aInIsolatedMozBrowser */ false);
+
+ ASSERT_FALSE(originAttributes.InIsolatedMozBrowser());
+ ASSERT_EQ(originAttributes.UserContextId(), 0u);
+ }
+
+ {
+ StorageOriginAttributes originAttributes(/* aInIsolatedMozBrowser */ true);
+
+ ASSERT_TRUE(originAttributes.InIsolatedMozBrowser());
+ ASSERT_EQ(originAttributes.UserContextId(), 0u);
+ }
+}
+
TEST(DOM_Quota_StorageOriginAttributes, PopulateFromOrigin_NoOriginAttributes)
{
{
@@ -162,4 +189,52 @@ TEST(DOM_Quota_StorageOriginAttributes, PopulateFromOrigin_Mixed_Invalid)
}
}
+TEST(DOM_Quota_StorageOriginAttributes, CreateSuffix_NoOriginAttributes)
+{
+ {
+ StorageOriginAttributes originAttributes;
+ nsCString suffix;
+ originAttributes.CreateSuffix(suffix);
+
+ ASSERT_TRUE(suffix.IsEmpty());
+ }
+}
+
+TEST(DOM_Quota_StorageOriginAttributes, CreateSuffix_InIsolatedMozbrowser)
+{
+ {
+ StorageOriginAttributes originAttributes;
+ originAttributes.SetInIsolatedMozBrowser(true);
+ nsCString suffix;
+ originAttributes.CreateSuffix(suffix);
+
+ ASSERT_TRUE(suffix.Equals("^inBrowser=1"_ns));
+ }
+}
+
+TEST(DOM_Quota_StorageOriginAttributes, CreateSuffix_UserContextId)
+{
+ {
+ StorageOriginAttributes originAttributes;
+ originAttributes.SetUserContextId(42);
+ nsCString suffix;
+ originAttributes.CreateSuffix(suffix);
+
+ ASSERT_TRUE(suffix.Equals("^userContextId=42"_ns));
+ }
+}
+
+TEST(DOM_Quota_StorageOriginAttributes, CreateSuffix_Mixed)
+{
+ {
+ StorageOriginAttributes originAttributes;
+ originAttributes.SetInIsolatedMozBrowser(true);
+ originAttributes.SetUserContextId(42);
+ nsCString suffix;
+ originAttributes.CreateSuffix(suffix);
+
+ ASSERT_TRUE(suffix.Equals("^inBrowser=1&userContextId=42"_ns));
+ }
+}
+
} // namespace mozilla::dom::quota::test