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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/CompactHTMLTokenTest.cpp

Issue 1392863002: Fix HTMLToken::Attribute::value handling in AtomicHTMLToken (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Style fix. Created 5 years, 2 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 unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698