summaryrefslogtreecommitdiffstats
path: root/base/string_tokenizer_unittest.cc
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 21:41:09 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 21:41:09 +0000
commitcbb7d42a93299955a5bc6ed8b078e60737ca885b (patch)
tree5af908cc470d2c1b9a86c644ad68febdcaf8766d /base/string_tokenizer_unittest.cc
parentbac10610a94b68c1a9a75ebbae0c92119ee79643 (diff)
downloadchromium_src-cbb7d42a93299955a5bc6ed8b078e60737ca885b.zip
chromium_src-cbb7d42a93299955a5bc6ed8b078e60737ca885b.tar.gz
chromium_src-cbb7d42a93299955a5bc6ed8b078e60737ca885b.tar.bz2
Adding support for Reset in StringTokenizerT and HttpHeadersIterator.
TEST=Run HeadersIterator_Reset and the Reset test for StringTokenizer BUG=none Review URL: http://codereview.chromium.org/276067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29330 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_tokenizer_unittest.cc')
-rw-r--r--base/string_tokenizer_unittest.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/base/string_tokenizer_unittest.cc b/base/string_tokenizer_unittest.cc
index a9e98cd..80cb960 100644
--- a/base/string_tokenizer_unittest.cc
+++ b/base/string_tokenizer_unittest.cc
@@ -30,6 +30,28 @@ TEST(StringTokenizerTest, Simple) {
EXPECT_FALSE(t.GetNext());
}
+TEST(StringTokenizerTest, Reset) {
+ string input = "this is a test";
+ StringTokenizer t(input, " ");
+
+ for (int i = 0; i < 2; ++i) {
+ EXPECT_TRUE(t.GetNext());
+ EXPECT_EQ(string("this"), t.token());
+
+ EXPECT_TRUE(t.GetNext());
+ EXPECT_EQ(string("is"), t.token());
+
+ EXPECT_TRUE(t.GetNext());
+ EXPECT_EQ(string("a"), t.token());
+
+ EXPECT_TRUE(t.GetNext());
+ EXPECT_EQ(string("test"), t.token());
+
+ EXPECT_FALSE(t.GetNext());
+ t.Reset();
+ }
+}
+
TEST(StringTokenizerTest, RetDelims) {
string input = "this is a test";
StringTokenizer t(input, " ");