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

Unified Diff: net/http/http_util_unittest.cc

Issue 9296005: Delete net::GetHeaderParamValue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 11 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: net/http/http_util_unittest.cc
===================================================================
--- net/http/http_util_unittest.cc (revision 119390)
+++ net/http/http_util_unittest.cc (working copy)
@@ -632,6 +632,36 @@
HttpUtil::GenerateAcceptCharsetHeader("EUC-JP"));
}
+TEST(HttpUtilTest, ParseContentType) {
+ const struct {
+ const char* content_type;
+ const char* expected_mime_type;
+ const char* expected_charset;
+ const bool expected_had_charset;
+ const char* expected_boundary;
+ } tests[] = {
+ { "text/html; boundary=\"WebKit-ada-df-dsf-adsfadsfs\"",
+ "text/html",
+ "",
+ false,
+ "\"WebKit-ada-df-dsf-adsfadsfs\""
+ }
+ // TODO(abarth): Add more interesting test cases.
+ };
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
+ std::string mime_type;
+ std::string charset;
+ bool had_charset;
+ std::string boundary;
+ net::HttpUtil::ParseContentType(tests[i].content_type, &mime_type,
+ &charset, &had_charset, &boundary);
+ EXPECT_EQ(tests[i].expected_mime_type, mime_type) << "i=" << i;
+ EXPECT_EQ(tests[i].expected_charset, charset) << "i=" << i;
+ EXPECT_EQ(tests[i].expected_had_charset, had_charset) << "i=" << i;
+ EXPECT_EQ(tests[i].expected_boundary, boundary) << "i=" << i;
+ }
+}
+
TEST(HttpUtilTest, ParseRanges) {
const struct {
const char* headers;

Powered by Google App Engine
This is Rietveld 408576698