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

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

Issue 1650473002: Setting selectorText of PageRule accepts invalid selectors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated as per review comments Created 4 years, 11 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
Index: third_party/WebKit/Source/core/css/CSSPageRuleTest.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSPageRuleTest.cpp b/third_party/WebKit/Source/core/css/CSSPageRuleTest.cpp
index b19737f552e7489871c42728a351ee7a50c9e513..c452af8bcdd55a73e452f9381c9b61a7548a71c4 100644
--- a/third_party/WebKit/Source/core/css/CSSPageRuleTest.cpp
+++ b/third_party/WebKit/Source/core/css/CSSPageRuleTest.cpp
@@ -26,4 +26,29 @@ TEST(CSSPageRule, Serializing)
}
}
+TEST(CSSPageRule, selectorText)
+{
+ CSSTestHelper helper;
+
+ const char* cssRule = "@page :left { size: auto; }";
+ helper.addCSSRules(cssRule);
+ ASSERT(helper.cssRules());
+ EXPECT_EQ(1u, helper.cssRules()->length());
+
+ CSSPageRule* pageRule = toCSSPageRule(helper.cssRules()->item(0));
+ EXPECT_EQ(":left", pageRule->selectorText());
+
+ // set invalid page selector.
+ pageRule->setSelectorText(":hover");
+ EXPECT_EQ(":left", pageRule->selectorText());
+
+ // set page pseudo class selector.
+ pageRule->setSelectorText(":right");
+ EXPECT_EQ(":right", pageRule->selectorText());
+
+ // set page type selector.
+ pageRule->setSelectorText("namedpage");
+ EXPECT_EQ("namedpage", pageRule->selectorText());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698