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

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLTokenizerTest.cpp

Issue 2121703002: Change HTMLTokenizer::Attribute::Range.start initial invalid value from 0 -> -1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update check Created 4 years, 5 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/HTMLTokenizerTest.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTokenizerTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLTokenizerTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1b98177a045973304b8c4af5e6150bc7948f77f4
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/parser/HTMLTokenizerTest.cpp
@@ -0,0 +1,32 @@
+// Copyright 2016 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 "core/html/parser/HTMLTokenizer.h"
+
+#include "core/html/parser/HTMLParserOptions.h"
+#include "core/html/parser/HTMLToken.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+#include <memory>
+
+namespace blink {
+
+// This is a regression test for crbug.com/619141
+TEST(HTMLTokenizerTest, ZeroOffsetAttributeNameRange)
+{
+ HTMLParserOptions options;
+ std::unique_ptr<HTMLTokenizer> tokenizer = HTMLTokenizer::create(options);
+ HTMLToken token;
+
+ SegmentedString input("<script ");
+ EXPECT_FALSE(tokenizer->nextToken(input, token));
+
+ EXPECT_EQ(HTMLToken::StartTag, token.type());
+
+ SegmentedString input2("type='javascript'");
+ // Below should not fail ASSERT
+ EXPECT_FALSE(tokenizer->nextToken(input2, token));
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698