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

Unified Diff: Source/core/css/parser/NewCSSTokenizerTest.cpp

Issue 123053002: Add very basic CSS3 Syntax compatible tokenizer Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add CSSToken file Created 6 years, 12 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: Source/core/css/parser/NewCSSTokenizerTest.cpp
diff --git a/Source/heap/HeapTest.cpp b/Source/core/css/parser/NewCSSTokenizerTest.cpp
similarity index 74%
copy from Source/heap/HeapTest.cpp
copy to Source/core/css/parser/NewCSSTokenizerTest.cpp
index 02e39a5eb9e5ff7e429b2a6a31d79bcf6c788918..5acfe52cb5b31591857b4a80757490f98412591a 100644
--- a/Source/heap/HeapTest.cpp
+++ b/Source/core/css/parser/NewCSSTokenizerTest.cpp
@@ -30,7 +30,8 @@
#include "config.h"
-#include "heap/Heap.h"
+#include "core/css/parser/NewCSSTokenizer.h"
+#include "wtf/PassOwnPtr.h"
#include <gtest/gtest.h>
@@ -38,10 +39,24 @@ using namespace WebCore;
namespace {
-TEST(HeapTest, Init)
+void tokenize(String string, Vector<CSSToken>& outTokens)
{
- Heap::init(0);
- Heap::shutdown();
+ NewCSSTokenizer tokenizer;
+ CSSInputStream input(string);
+ while (true) {
+ outTokens.append(tokenizer.nextToken(input));
+ if (outTokens.last().type() == EOFToken)
+ return;
+ }
+}
+
+TEST(CSSTokenizerTest, Basic)
+{
+ Vector<CSSToken> tokens;
+ tokenize("foo", tokens);
+ printf("%zu\n", tokens.size());
+ for (size_t i = 0; i < tokens.size(); i++)
+ printf("%zu: %i\n", i, tokens[i].type());
}
} // namespace
« Source/core/css/parser/NewCSSTokenizer.cpp ('K') | « Source/core/css/parser/NewCSSTokenizer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698