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

Unified Diff: net/http/http_util_unittest.cc

Issue 276067: Adding support for Reset in StringTokenizerT and HttpHeadersIterator.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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
« no previous file with comments | « net/http/http_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_util_unittest.cc
===================================================================
--- net/http/http_util_unittest.cc (revision 29282)
+++ net/http/http_util_unittest.cc (working copy)
@@ -105,6 +105,19 @@
EXPECT_FALSE(it.GetNext()); // should be at end of headers
}
+TEST(HttpUtilTest, HeadersIterator_Reset) {
+ std::string headers = "foo: 1\r\n: 2\r\n3\r\nbar: 4";
+ HttpUtil::HeadersIterator it(headers.begin(), headers.end(), "\r\n");
+ // Search past "foo".
+ EXPECT_TRUE(it.AdvanceTo("bar"));
+ // Now try advancing to "foo". This time it should fail since the iterator
+ // position is past it.
+ EXPECT_FALSE(it.AdvanceTo("foo"));
+ it.Reset();
+ // Now that we reset the iterator position, we should find 'foo'
+ EXPECT_TRUE(it.AdvanceTo("foo"));
+}
+
TEST(HttpUtilTest, ValuesIterator) {
std::string values = " must-revalidate, no-cache=\"foo, bar\"\t, private ";
« no previous file with comments | « net/http/http_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698