Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp

Issue 2284633002: Allow multiple type and id selectors in invalidation set features. (Closed)
Patch Set: Unit tests Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/RuleFeature.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp
diff --git a/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp b/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp
index 4afd7ba6ee4116a8d6dc54f62ca28c765b28438e..eba129ca4d501a6a39d17cff5d29311ba841a9cc 100644
--- a/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp
+++ b/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp
@@ -211,6 +211,15 @@ public:
EXPECT_TRUE(ids.contains(id));
}
+ void expectIdsInvalidation(const AtomicString& firstId, const AtomicString& secondId, InvalidationSetVector& invalidationSets)
+ {
+ EXPECT_EQ(1u, invalidationSets.size());
+ HashSet<AtomicString> ids = idSet(*invalidationSets[0]);
+ EXPECT_EQ(2u, ids.size());
+ EXPECT_TRUE(ids.contains(firstId));
+ EXPECT_TRUE(ids.contains(secondId));
+ }
+
void expectTagNameInvalidation(const AtomicString& tagName, InvalidationSetVector& invalidationSets)
{
EXPECT_EQ(1u, invalidationSets.size());
@@ -219,6 +228,15 @@ public:
EXPECT_TRUE(tagNames.contains(tagName));
}
+ void expectTagNamesInvalidation(const AtomicString& firstTagName, const AtomicString& secondTagName, InvalidationSetVector& invalidationSets)
+ {
+ EXPECT_EQ(1u, invalidationSets.size());
+ HashSet<AtomicString> tagNames = tagNameSet(*invalidationSets[0]);
+ EXPECT_EQ(2u, tagNames.size());
+ EXPECT_TRUE(tagNames.contains(firstTagName));
+ EXPECT_TRUE(tagNames.contains(secondTagName));
+ }
+
void expectAttributeInvalidation(const AtomicString& attribute, InvalidationSetVector& invalidationSets)
{
EXPECT_EQ(1u, invalidationSets.size());
@@ -324,6 +342,25 @@ TEST_F(RuleFeatureSetTest, any)
expectNoInvalidation(invalidationLists.siblings);
}
+
+TEST_F(RuleFeatureSetTest, anyIdDescendant)
+{
+ EXPECT_EQ(RuleFeatureSet::SelectorMayMatch, collectFeatures(".a :-webkit-any(#b, #c)"));
+
+ InvalidationLists invalidationLists;
+ collectInvalidationSetsForClass(invalidationLists, "a");
+ expectIdsInvalidation("b", "c", invalidationLists.descendants);
+}
+
+TEST_F(RuleFeatureSetTest, anyTagDescendant)
+{
+ EXPECT_EQ(RuleFeatureSet::SelectorMayMatch, collectFeatures(".a :-webkit-any(span, div)"));
+
+ InvalidationLists invalidationLists;
+ collectInvalidationSetsForClass(invalidationLists, "a");
+ expectTagNamesInvalidation("span", "div", invalidationLists.descendants);
+}
+
TEST_F(RuleFeatureSetTest, siblingAny)
{
EXPECT_EQ(RuleFeatureSet::SelectorMayMatch, collectFeatures(".v ~ :-webkit-any(.w, .x)"));
« no previous file with comments | « third_party/WebKit/Source/core/css/RuleFeature.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698