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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/parser/CompactHTMLTokenTest.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/CompactHTMLTokenTest.cpp b/third_party/WebKit/Source/core/html/parser/CompactHTMLTokenTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f35767ba5c9732167b1a35af5d392e0b3104e6cf
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/parser/CompactHTMLTokenTest.cpp
@@ -0,0 +1,46 @@
+// Copyright 2015 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/html/parser/CompactHTMLToken.h"
+
+#include <gtest/gtest.h>
+
+namespace blink {
+
+TEST(CompactHTMLTokenTest, EmptyAttributeValueFromHTMLToken)
+{
+ HTMLToken token;
+ token.beginStartTag('a');
+ token.addNewAttribute();
+ token.beginAttributeName(3);
+ token.appendToAttributeName('b');
+ token.endAttributeName(4);
+ token.addNewAttribute();
+ token.beginAttributeName(5);
+ token.appendToAttributeName('c');
+ token.endAttributeName(6);
+ token.beginAttributeValue(8);
+ token.endAttributeValue(8);
+
+ CompactHTMLToken ctoken(&token, TextPosition());
+
+ const CompactHTMLToken::Attribute* attributeB = ctoken.getAttributeItem(
+ QualifiedName(AtomicString(), "b", AtomicString()));
+ ASSERT_TRUE(attributeB);
+ EXPECT_FALSE(attributeB->value.isNull());
+ EXPECT_TRUE(attributeB->value.isEmpty());
+
+ const CompactHTMLToken::Attribute* attributeC = ctoken.getAttributeItem(
+ QualifiedName(AtomicString(), "c", AtomicString()));
+ ASSERT_TRUE(attributeC);
+ EXPECT_FALSE(attributeC->value.isNull());
+ EXPECT_TRUE(attributeC->value.isEmpty());
+
+ const CompactHTMLToken::Attribute* attributeD = ctoken.getAttributeItem(
+ QualifiedName(AtomicString(), "d", AtomicString()));
+ EXPECT_FALSE(attributeD);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698