OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "core/html/parser/CompactHTMLToken.h" |
| 7 |
| 8 #include <gtest/gtest.h> |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 TEST(CompactHTMLTokenTest, EmptyAttributeValueFromHTMLToken) |
| 13 { |
| 14 HTMLToken token; |
| 15 token.beginStartTag('a'); |
| 16 token.addNewAttribute(); |
| 17 token.beginAttributeName(3); |
| 18 token.appendToAttributeName('b'); |
| 19 token.endAttributeName(4); |
| 20 token.addNewAttribute(); |
| 21 token.beginAttributeName(5); |
| 22 token.appendToAttributeName('c'); |
| 23 token.endAttributeName(6); |
| 24 token.beginAttributeValue(8); |
| 25 token.endAttributeValue(8); |
| 26 |
| 27 CompactHTMLToken ctoken(&token, TextPosition()); |
| 28 |
| 29 const CompactHTMLToken::Attribute* attributeB = ctoken.getAttributeItem( |
| 30 QualifiedName(AtomicString(), "b", AtomicString())); |
| 31 ASSERT_TRUE(attributeB); |
| 32 EXPECT_FALSE(attributeB->value.isNull()); |
| 33 EXPECT_TRUE(attributeB->value.isEmpty()); |
| 34 |
| 35 const CompactHTMLToken::Attribute* attributeC = ctoken.getAttributeItem( |
| 36 QualifiedName(AtomicString(), "c", AtomicString())); |
| 37 ASSERT_TRUE(attributeC); |
| 38 EXPECT_FALSE(attributeC->value.isNull()); |
| 39 EXPECT_TRUE(attributeC->value.isEmpty()); |
| 40 |
| 41 const CompactHTMLToken::Attribute* attributeD = ctoken.getAttributeItem( |
| 42 QualifiedName(AtomicString(), "d", AtomicString())); |
| 43 EXPECT_FALSE(attributeD); |
| 44 } |
| 45 |
| 46 } // namespace blink |
OLD | NEW |