Merge from Chromium at DEPS revision 251904
This commit was generated by merge_to_master.py.
Change-Id: I8ca36eee41eba7e9a56d6728a9d19e5883d7058c
diff --git a/Source/core/css/CSSSelectorTest.cpp b/Source/core/css/CSSSelectorTest.cpp
new file mode 100644
index 0000000..baf0465
--- /dev/null
+++ b/Source/core/css/CSSSelectorTest.cpp
@@ -0,0 +1,58 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/css/CSSTestHelper.h"
+#include "core/css/RuleSet.h"
+
+#include <gtest/gtest.h>
+
+namespace WebCore {
+
+TEST(CSSSelector, Representations)
+{
+ CSSTestHelper helper;
+
+ const char* cssRules =
+ "summary::-webkit-details-marker { }"
+ "* {}"
+ "div {}"
+ "#id {}"
+ ".class {}"
+ "[attr] {}"
+ "div:hover {}"
+ "div:nth-child(2){}"
+ ".class#id { }"
+ "#id.class { }"
+ "[attr]#id { }"
+ "div[attr]#id { }"
+ "div::content { }"
+ "div::first-line { }"
+ ".a.b.c { }"
+ "div:not(.a) { }" // without class a
+ "div:not(:visited) { }" // without the visited pseudo class
+
+ "[attr=\"value\"] { }" // Exact equality
+ "[attr~=\"value\"] { }" // One of a space-separated list
+ "[attr^=\"value\"] { }" // Begins with
+ "[attr$=\"value\"] { }" // Ends with
+ "[attr*=\"value\"] { }" // Substring equal to
+ "[attr|=\"value\"] { }" // One of a hyphen-separated list
+
+ ".a .b { }" // .b is a descendant of .a
+ ".a > .b { }" // .b is a direct descendant of .a
+ ".a ~ .b { }" // .a precedes .b in sibling order
+ ".a + .b { }" // .a element immediately precedes .b in sibling order
+ ".a, .b { }" // matches .a or .b
+
+ ".a.b .c {}";
+
+ helper.addCSSRules(cssRules);
+ EXPECT_EQ(30u, helper.ruleSet().ruleCount()); // .a, .b counts as two rules.
+#ifndef NDEBUG
+ helper.ruleSet().show();
+#endif
+}
+
+} // namespace WebCore