OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/dom/SelectorQuery.h" | 5 #include "core/dom/SelectorQuery.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include "core/css/parser/CSSParser.h" | 8 #include "core/css/parser/CSSParser.h" |
9 #include "core/css/parser/CSSParserContext.h" | 9 #include "core/css/parser/CSSParserContext.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 EXPECT_EQ(test_case.stats.fast_id, stats.fast_id); | 51 EXPECT_EQ(test_case.stats.fast_id, stats.fast_id); |
52 EXPECT_EQ(test_case.stats.fast_class, stats.fast_class); | 52 EXPECT_EQ(test_case.stats.fast_class, stats.fast_class); |
53 EXPECT_EQ(test_case.stats.fast_tag_name, stats.fast_tag_name); | 53 EXPECT_EQ(test_case.stats.fast_tag_name, stats.fast_tag_name); |
54 EXPECT_EQ(test_case.stats.fast_scan, stats.fast_scan); | 54 EXPECT_EQ(test_case.stats.fast_scan, stats.fast_scan); |
55 EXPECT_EQ(test_case.stats.slow_scan, stats.slow_scan); | 55 EXPECT_EQ(test_case.stats.slow_scan, stats.slow_scan); |
56 EXPECT_EQ(test_case.stats.slow_traversing_shadow_tree_scan, | 56 EXPECT_EQ(test_case.stats.slow_traversing_shadow_tree_scan, |
57 stats.slow_traversing_shadow_tree_scan); | 57 stats.slow_traversing_shadow_tree_scan); |
58 #endif | 58 #endif |
59 } | 59 } |
60 } | 60 } |
61 }; | 61 }; // namespace |
62 | 62 |
63 TEST(SelectorQueryTest, NotMatchingPseudoElement) { | 63 TEST(SelectorQueryTest, NotMatchingPseudoElement) { |
64 Document* document = Document::Create(); | 64 Document* document = Document::Create(); |
65 HTMLHtmlElement* html = HTMLHtmlElement::Create(*document); | 65 HTMLHtmlElement* html = HTMLHtmlElement::Create(*document); |
66 document->AppendChild(html); | 66 document->AppendChild(html); |
67 document->documentElement()->setInnerHTML( | 67 document->documentElement()->setInnerHTML( |
68 "<body><style>span::before { content: 'X' }</style><span></span></body>"); | 68 "<body><style>span::before { content: 'X' }</style><span></span></body>"); |
69 | 69 |
70 CSSSelectorList selector_list = CSSParser::ParseSelector( | 70 CSSSelectorList selector_list = CSSParser::ParseSelector( |
71 CSSParserContext::Create(*document, KURL(), kReferrerPolicyDefault, | 71 CSSParserContext::Create(*document, KURL(), kReferrerPolicyDefault, |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 {".child", false, 1, {4, 0, 4, 0, 0, 0, 0}}, | 374 {".child", false, 1, {4, 0, 4, 0, 0, 0, 0}}, |
375 {".child", true, 2, {6, 0, 6, 0, 0, 0, 0}}, | 375 {".child", true, 2, {6, 0, 6, 0, 0, 0, 0}}, |
376 {"#first span", false, 1, {2, 1, 0, 0, 1, 0, 0}}, | 376 {"#first span", false, 1, {2, 1, 0, 0, 1, 0, 0}}, |
377 {"#first span", true, 4, {5, 1, 0, 0, 4, 0, 0}}, | 377 {"#first span", true, 4, {5, 1, 0, 0, 4, 0, 0}}, |
378 }; | 378 }; |
379 | 379 |
380 RunTests(shadowRoot, kTestCases); | 380 RunTests(shadowRoot, kTestCases); |
381 } | 381 } |
382 | 382 |
383 } // namespace blink | 383 } // namespace blink |
OLD | NEW |