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

Unified Diff: Source/platform/CommaDelimitedParserTest.cpp

Issue 961773002: Add a comma delimited syntax parser and use it for Accept-CH (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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/platform/CommaDelimitedParserTest.cpp
diff --git a/Source/platform/CommaDelimitedParserTest.cpp b/Source/platform/CommaDelimitedParserTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b5f1e8778938b1699f4cc149532d6669e66e8fd3
--- /dev/null
+++ b/Source/platform/CommaDelimitedParserTest.cpp
@@ -0,0 +1,32 @@
+// 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 "CommaDelimitedParser.h"
+
+#include <gtest/gtest.h>
+
+namespace blink {
+
+TEST(CommaDelimitedParserTest, Basic)
+{
+ {
+ CommaDelimitedParser parser("dpr, rw, whatever");
+ EXPECT_TRUE(parser.contains("dpr"));
+ EXPECT_TRUE(parser.contains("rw"));
+ EXPECT_TRUE(parser.contains("whatever"));
+ }
+ {
+ CommaDelimitedParser parser("dprw\t , fo\to");
+ EXPECT_FALSE(parser.contains("dpr"));
+ EXPECT_FALSE(parser.contains("rw"));
+ EXPECT_FALSE(parser.contains("whatever"));
+ EXPECT_TRUE(parser.contains("dprw"));
+ EXPECT_FALSE(parser.contains("foo"));
+ EXPECT_TRUE(parser.contains("fo\to"));
+ }
+}
+
+} // namespace blink
+

Powered by Google App Engine
This is Rietveld 408576698