1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/basictypes.h"
6 #include "base/strings/string_split.h"
7 #include "base/strings/utf_string_conversions.h"
8 #include "net/base/mime_util.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 #if defined(OS_ANDROID)
12 #include "base/android/build_info.h"
17 TEST(MimeUtilTest
, ExtensionTest
) {
19 const base::FilePath::CharType
* extension
;
20 const char* mime_type
;
23 { FILE_PATH_LITERAL("png"), "image/png", true },
24 { FILE_PATH_LITERAL("css"), "text/css", true },
25 { FILE_PATH_LITERAL("pjp"), "image/jpeg", true },
26 { FILE_PATH_LITERAL("pjpeg"), "image/jpeg", true },
27 { FILE_PATH_LITERAL("not an extension / for sure"), "", false },
30 std::string mime_type
;
33 for (size_t i
= 0; i
< ARRAYSIZE_UNSAFE(tests
); ++i
) {
34 rv
= GetMimeTypeFromExtension(tests
[i
].extension
, &mime_type
);
35 EXPECT_EQ(tests
[i
].valid
, rv
);
37 EXPECT_EQ(tests
[i
].mime_type
, mime_type
);
41 TEST(MimeUtilTest
, FileTest
) {
43 const base::FilePath::CharType
* file_path
;
44 const char* mime_type
;
47 { FILE_PATH_LITERAL("c:\\foo\\bar.css"), "text/css", true },
48 { FILE_PATH_LITERAL("c:\\blah"), "", false },
49 { FILE_PATH_LITERAL("/usr/local/bin/mplayer"), "", false },
50 { FILE_PATH_LITERAL("/home/foo/bar.css"), "text/css", true },
51 { FILE_PATH_LITERAL("/blah."), "", false },
52 { FILE_PATH_LITERAL("c:\\blah."), "", false },
55 std::string mime_type
;
58 for (size_t i
= 0; i
< ARRAYSIZE_UNSAFE(tests
); ++i
) {
59 rv
= GetMimeTypeFromFile(base::FilePath(tests
[i
].file_path
),
61 EXPECT_EQ(tests
[i
].valid
, rv
);
63 EXPECT_EQ(tests
[i
].mime_type
, mime_type
);
67 TEST(MimeUtilTest
, LookupTypes
) {
68 EXPECT_FALSE(IsUnsupportedTextMimeType("text/banana"));
69 EXPECT_TRUE(IsUnsupportedTextMimeType("text/vcard"));
71 EXPECT_TRUE(IsSupportedImageMimeType("image/jpeg"));
72 EXPECT_FALSE(IsSupportedImageMimeType("image/lolcat"));
73 EXPECT_TRUE(IsSupportedNonImageMimeType("text/html"));
74 EXPECT_TRUE(IsSupportedNonImageMimeType("text/css"));
75 EXPECT_TRUE(IsSupportedNonImageMimeType("text/"));
76 EXPECT_TRUE(IsSupportedNonImageMimeType("text/banana"));
77 EXPECT_FALSE(IsSupportedNonImageMimeType("text/vcard"));
78 EXPECT_FALSE(IsSupportedNonImageMimeType("application/virus"));
79 EXPECT_TRUE(IsSupportedNonImageMimeType("application/x-x509-user-cert"));
80 EXPECT_TRUE(IsSupportedNonImageMimeType("application/json"));
81 EXPECT_TRUE(IsSupportedNonImageMimeType("application/+json"));
82 EXPECT_TRUE(IsSupportedNonImageMimeType("application/x-suggestions+json"));
83 EXPECT_TRUE(IsSupportedNonImageMimeType("application/x-s+json;x=2"));
84 #if defined(OS_ANDROID)
85 EXPECT_TRUE(IsSupportedNonImageMimeType("application/x-x509-ca-cert"));
86 EXPECT_TRUE(IsSupportedNonImageMimeType("application/x-pkcs12"));
87 EXPECT_TRUE(IsSupportedMediaMimeType("application/vnd.apple.mpegurl"));
88 EXPECT_TRUE(IsSupportedMediaMimeType("application/x-mpegurl"));
91 EXPECT_TRUE(IsSupportedMimeType("image/jpeg"));
92 EXPECT_FALSE(IsSupportedMimeType("image/lolcat"));
93 EXPECT_TRUE(IsSupportedMimeType("text/html"));
94 EXPECT_TRUE(IsSupportedMimeType("text/banana"));
95 EXPECT_FALSE(IsSupportedMimeType("text/vcard"));
96 EXPECT_FALSE(IsSupportedMimeType("application/virus"));
97 EXPECT_FALSE(IsSupportedMimeType("application/x-json"));
98 EXPECT_FALSE(IsSupportedNonImageMimeType("application/vnd.doc;x=y+json"));
101 TEST(MimeUtilTest
, StrictMediaMimeType
) {
102 EXPECT_TRUE(IsStrictMediaMimeType("video/webm"));
103 EXPECT_TRUE(IsStrictMediaMimeType("audio/webm"));
105 EXPECT_TRUE(IsStrictMediaMimeType("audio/wav"));
106 EXPECT_TRUE(IsStrictMediaMimeType("audio/x-wav"));
108 EXPECT_TRUE(IsStrictMediaMimeType("video/ogg"));
109 EXPECT_TRUE(IsStrictMediaMimeType("audio/ogg"));
110 EXPECT_TRUE(IsStrictMediaMimeType("application/ogg"));
112 EXPECT_TRUE(IsStrictMediaMimeType("audio/mpeg"));
113 EXPECT_TRUE(IsStrictMediaMimeType("audio/mp3"));
114 EXPECT_TRUE(IsStrictMediaMimeType("audio/x-mp3"));
116 EXPECT_TRUE(IsStrictMediaMimeType("video/mp4"));
117 EXPECT_TRUE(IsStrictMediaMimeType("video/x-m4v"));
118 EXPECT_TRUE(IsStrictMediaMimeType("audio/mp4"));
119 EXPECT_TRUE(IsStrictMediaMimeType("audio/x-m4a"));
121 EXPECT_TRUE(IsStrictMediaMimeType("application/x-mpegurl"));
122 EXPECT_TRUE(IsStrictMediaMimeType("application/vnd.apple.mpegurl"));
124 EXPECT_FALSE(IsStrictMediaMimeType("video/unknown"));
125 EXPECT_FALSE(IsStrictMediaMimeType("audio/unknown"));
126 EXPECT_FALSE(IsStrictMediaMimeType("application/unknown"));
127 EXPECT_FALSE(IsStrictMediaMimeType("unknown/unknown"));
130 TEST(MimeUtilTest
, MatchesMimeType
) {
131 EXPECT_TRUE(MatchesMimeType("*", "video/x-mpeg"));
132 EXPECT_TRUE(MatchesMimeType("video/*", "video/x-mpeg"));
133 EXPECT_TRUE(MatchesMimeType("video/*", "video/*"));
134 EXPECT_TRUE(MatchesMimeType("video/x-mpeg", "video/x-mpeg"));
135 EXPECT_TRUE(MatchesMimeType("application/*+xml",
136 "application/html+xml"));
137 EXPECT_TRUE(MatchesMimeType("application/*+xml", "application/+xml"));
138 EXPECT_TRUE(MatchesMimeType("application/*+json",
139 "application/x-myformat+json"));
140 EXPECT_TRUE(MatchesMimeType("aaa*aaa", "aaaaaa"));
141 EXPECT_TRUE(MatchesMimeType("*", std::string()));
142 EXPECT_FALSE(MatchesMimeType("video/", "video/x-mpeg"));
143 EXPECT_FALSE(MatchesMimeType(std::string(), "video/x-mpeg"));
144 EXPECT_FALSE(MatchesMimeType(std::string(), std::string()));
145 EXPECT_FALSE(MatchesMimeType("video/x-mpeg", std::string()));
146 EXPECT_FALSE(MatchesMimeType("application/*+xml", "application/xml"));
147 EXPECT_FALSE(MatchesMimeType("application/*+xml",
148 "application/html+xmlz"));
149 EXPECT_FALSE(MatchesMimeType("application/*+xml",
150 "applcation/html+xml"));
151 EXPECT_FALSE(MatchesMimeType("aaa*aaa", "aaaaa"));
153 EXPECT_TRUE(MatchesMimeType("*", "video/x-mpeg;param=val"));
154 EXPECT_TRUE(MatchesMimeType("video/*", "video/x-mpeg;param=val"));
155 EXPECT_FALSE(MatchesMimeType("video/*;param=val", "video/mpeg"));
156 EXPECT_FALSE(MatchesMimeType("video/*;param=val", "video/mpeg;param=other"));
157 EXPECT_TRUE(MatchesMimeType("video/*;param=val", "video/mpeg;param=val"));
158 EXPECT_TRUE(MatchesMimeType("video/x-mpeg", "video/x-mpeg;param=val"));
159 EXPECT_TRUE(MatchesMimeType("video/x-mpeg;param=val",
160 "video/x-mpeg;param=val"));
161 EXPECT_FALSE(MatchesMimeType("video/x-mpeg;param2=val2",
162 "video/x-mpeg;param=val"));
163 EXPECT_FALSE(MatchesMimeType("video/x-mpeg;param2=val2",
164 "video/x-mpeg;param2=val"));
165 EXPECT_TRUE(MatchesMimeType("video/x-mpeg;param=val",
166 "video/x-mpeg;param=val;param2=val2"));
167 EXPECT_TRUE(MatchesMimeType("video/x-mpeg;param=val;param2=val2",
168 "video/x-mpeg;param=val;param2=val2"));
169 EXPECT_TRUE(MatchesMimeType("video/x-mpeg;param2=val2;param=val",
170 "video/x-mpeg;param=val;param2=val2"));
171 EXPECT_FALSE(MatchesMimeType("video/x-mpeg;param3=val3;param=val",
172 "video/x-mpeg;param=val;param2=val2"));
173 EXPECT_TRUE(MatchesMimeType("video/x-mpeg;param=val ;param2=val2 ",
174 "video/x-mpeg;param=val;param2=val2"));
176 EXPECT_TRUE(MatchesMimeType("*/*;param=val", "video/x-mpeg;param=val"));
177 EXPECT_FALSE(MatchesMimeType("*/*;param=val", "video/x-mpeg;param=val2"));
179 EXPECT_TRUE(MatchesMimeType("*", "*"));
180 EXPECT_TRUE(MatchesMimeType("*", "*/*"));
181 EXPECT_TRUE(MatchesMimeType("*/*", "*/*"));
182 EXPECT_TRUE(MatchesMimeType("*/*", "*"));
183 EXPECT_TRUE(MatchesMimeType("video/*", "video/*"));
184 EXPECT_FALSE(MatchesMimeType("video/*", "*/*"));
185 EXPECT_FALSE(MatchesMimeType("video/*;param=val", "video/*"));
186 EXPECT_TRUE(MatchesMimeType("video/*;param=val", "video/*;param=val"));
187 EXPECT_FALSE(MatchesMimeType("video/*;param=val", "video/*;param=val2"));
189 EXPECT_TRUE(MatchesMimeType("ab*cd", "abxxxcd"));
190 EXPECT_TRUE(MatchesMimeType("ab*cd", "abx/xcd"));
191 EXPECT_TRUE(MatchesMimeType("ab/*cd", "ab/xxxcd"));
194 TEST(MimeUtilTest
, CommonMediaMimeType
) {
195 #if defined(OS_ANDROID)
197 if (base::android::BuildInfo::GetInstance()->sdk_int() < 14)
198 HLSSupported
= false;
203 EXPECT_TRUE(IsSupportedMediaMimeType("audio/webm"));
204 EXPECT_TRUE(IsSupportedMediaMimeType("video/webm"));
206 EXPECT_TRUE(IsSupportedMediaMimeType("audio/wav"));
207 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-wav"));
209 EXPECT_TRUE(IsSupportedMediaMimeType("audio/ogg"));
210 EXPECT_TRUE(IsSupportedMediaMimeType("application/ogg"));
211 #if defined(OS_ANDROID)
212 EXPECT_FALSE(IsSupportedMediaMimeType("video/ogg"));
213 EXPECT_EQ(HLSSupported
, IsSupportedMediaMimeType("application/x-mpegurl"));
214 EXPECT_EQ(HLSSupported
,
215 IsSupportedMediaMimeType("application/vnd.apple.mpegurl"));
217 EXPECT_TRUE(IsSupportedMediaMimeType("video/ogg"));
218 EXPECT_FALSE(IsSupportedMediaMimeType("application/x-mpegurl"));
219 EXPECT_FALSE(IsSupportedMediaMimeType("application/vnd.apple.mpegurl"));
222 #if defined(USE_PROPRIETARY_CODECS)
223 EXPECT_TRUE(IsSupportedMediaMimeType("audio/mp4"));
224 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-m4a"));
225 EXPECT_TRUE(IsSupportedMediaMimeType("video/mp4"));
226 EXPECT_TRUE(IsSupportedMediaMimeType("video/x-m4v"));
228 EXPECT_TRUE(IsSupportedMediaMimeType("audio/mp3"));
229 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-mp3"));
230 EXPECT_TRUE(IsSupportedMediaMimeType("audio/mpeg"));
232 EXPECT_FALSE(IsSupportedMediaMimeType("audio/mp4"));
233 EXPECT_FALSE(IsSupportedMediaMimeType("audio/x-m4a"));
234 EXPECT_FALSE(IsSupportedMediaMimeType("video/mp4"));
235 EXPECT_FALSE(IsSupportedMediaMimeType("video/x-m4v"));
237 EXPECT_FALSE(IsSupportedMediaMimeType("audio/mp3"));
238 EXPECT_FALSE(IsSupportedMediaMimeType("audio/x-mp3"));
239 EXPECT_FALSE(IsSupportedMediaMimeType("audio/mpeg"));
240 #endif // USE_PROPRIETARY_CODECS
241 EXPECT_FALSE(IsSupportedMediaMimeType("video/mp3"));
243 EXPECT_FALSE(IsSupportedMediaMimeType("video/unknown"));
244 EXPECT_FALSE(IsSupportedMediaMimeType("audio/unknown"));
245 EXPECT_FALSE(IsSupportedMediaMimeType("unknown/unknown"));
248 // Note: codecs should only be a list of 2 or fewer; hence the restriction of
249 // results' length to 2.
250 TEST(MimeUtilTest
, ParseCodecString
) {
252 const char* original
;
253 size_t expected_size
;
254 const char* results
[2];
256 { "\"bogus\"", 1, { "bogus" } },
258 { "avc1.42E01E, mp4a.40.2", 2, { "avc1", "mp4a" } },
259 { "\"mp4v.20.240, mp4a.40.2\"", 2, { "mp4v", "mp4a" } },
260 { "mp4v.20.8, samr", 2, { "mp4v", "samr" } },
261 { "\"theora, vorbis\"", 2, { "theora", "vorbis" } },
265 { ",", 2, { "", "" } },
268 for (size_t i
= 0; i
< ARRAYSIZE_UNSAFE(tests
); ++i
) {
269 std::vector
<std::string
> codecs_out
;
270 ParseCodecString(tests
[i
].original
, &codecs_out
, true);
271 ASSERT_EQ(tests
[i
].expected_size
, codecs_out
.size());
272 for (size_t j
= 0; j
< tests
[i
].expected_size
; ++j
)
273 EXPECT_EQ(tests
[i
].results
[j
], codecs_out
[j
]);
276 // Test without stripping the codec type.
277 std::vector
<std::string
> codecs_out
;
278 ParseCodecString("avc1.42E01E, mp4a.40.2", &codecs_out
, false);
279 ASSERT_EQ(2u, codecs_out
.size());
280 EXPECT_EQ("avc1.42E01E", codecs_out
[0]);
281 EXPECT_EQ("mp4a.40.2", codecs_out
[1]);
284 TEST(MimeUtilTest
, TestParseMimeTypeWithoutParameter
) {
285 std::string
nonAscii("application/nonutf8");
286 EXPECT_TRUE(ParseMimeTypeWithoutParameter(nonAscii
, NULL
, NULL
));
288 nonAscii
.append(base::WideToUTF8(std::wstring(L
"\u2603")));
290 nonAscii
.append("\u2603"); // unicode snowman
292 EXPECT_FALSE(ParseMimeTypeWithoutParameter(nonAscii
, NULL
, NULL
));
294 std::string top_level_type
;
296 EXPECT_TRUE(ParseMimeTypeWithoutParameter(
297 "application/mime", &top_level_type
, &subtype
));
298 EXPECT_EQ("application", top_level_type
);
299 EXPECT_EQ("mime", subtype
);
301 // Various allowed subtype forms.
302 EXPECT_TRUE(ParseMimeTypeWithoutParameter("application/json", NULL
, NULL
));
303 EXPECT_TRUE(ParseMimeTypeWithoutParameter(
304 "application/x-suggestions+json", NULL
, NULL
));
305 EXPECT_TRUE(ParseMimeTypeWithoutParameter("application/+json", NULL
, NULL
));
307 // Upper case letters are allowed.
308 EXPECT_TRUE(ParseMimeTypeWithoutParameter("text/mime", NULL
, NULL
));
309 EXPECT_TRUE(ParseMimeTypeWithoutParameter("TEXT/mime", NULL
, NULL
));
310 EXPECT_TRUE(ParseMimeTypeWithoutParameter("Text/mime", NULL
, NULL
));
311 EXPECT_TRUE(ParseMimeTypeWithoutParameter("TeXt/mime", NULL
, NULL
));
313 // Experimental types are also considered to be valid.
314 EXPECT_TRUE(ParseMimeTypeWithoutParameter("x-video/mime", NULL
, NULL
));
315 EXPECT_TRUE(ParseMimeTypeWithoutParameter("X-Video/mime", NULL
, NULL
));
317 EXPECT_FALSE(ParseMimeTypeWithoutParameter("text", NULL
, NULL
));
318 EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/", NULL
, NULL
));
319 EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/ ", NULL
, NULL
));
320 EXPECT_FALSE(ParseMimeTypeWithoutParameter("te(xt/ ", NULL
, NULL
));
321 EXPECT_FALSE(ParseMimeTypeWithoutParameter("text/()plain", NULL
, NULL
));
323 EXPECT_FALSE(ParseMimeTypeWithoutParameter("x-video", NULL
, NULL
));
324 EXPECT_FALSE(ParseMimeTypeWithoutParameter("x-video/", NULL
, NULL
));
326 EXPECT_FALSE(ParseMimeTypeWithoutParameter("application/a/b/c", NULL
, NULL
));
328 //EXPECT_TRUE(ParseMimeTypeWithoutParameter("video/mime;parameter"));
331 TEST(MimeUtilTest
, TestIsValidTopLevelMimeType
) {
332 EXPECT_TRUE(IsValidTopLevelMimeType("application"));
333 EXPECT_TRUE(IsValidTopLevelMimeType("audio"));
334 EXPECT_TRUE(IsValidTopLevelMimeType("example"));
335 EXPECT_TRUE(IsValidTopLevelMimeType("image"));
336 EXPECT_TRUE(IsValidTopLevelMimeType("message"));
337 EXPECT_TRUE(IsValidTopLevelMimeType("model"));
338 EXPECT_TRUE(IsValidTopLevelMimeType("multipart"));
339 EXPECT_TRUE(IsValidTopLevelMimeType("text"));
340 EXPECT_TRUE(IsValidTopLevelMimeType("video"));
342 EXPECT_TRUE(IsValidTopLevelMimeType("TEXT"));
343 EXPECT_TRUE(IsValidTopLevelMimeType("Text"));
344 EXPECT_TRUE(IsValidTopLevelMimeType("TeXt"));
346 EXPECT_FALSE(IsValidTopLevelMimeType("mime"));
347 EXPECT_FALSE(IsValidTopLevelMimeType(""));
348 EXPECT_FALSE(IsValidTopLevelMimeType("/"));
349 EXPECT_FALSE(IsValidTopLevelMimeType(" "));
351 EXPECT_TRUE(IsValidTopLevelMimeType("x-video"));
352 EXPECT_TRUE(IsValidTopLevelMimeType("X-video"));
354 EXPECT_FALSE(IsValidTopLevelMimeType("x-"));
357 TEST(MimeUtilTest
, TestToIANAMediaType
) {
358 EXPECT_EQ("", GetIANAMediaType("texting/driving"));
359 EXPECT_EQ("", GetIANAMediaType("ham/sandwich"));
360 EXPECT_EQ("", GetIANAMediaType(std::string()));
361 EXPECT_EQ("", GetIANAMediaType("/application/hamsandwich"));
363 EXPECT_EQ("application", GetIANAMediaType("application/poodle-wrestler"));
364 EXPECT_EQ("audio", GetIANAMediaType("audio/mpeg"));
365 EXPECT_EQ("example", GetIANAMediaType("example/yomomma"));
366 EXPECT_EQ("image", GetIANAMediaType("image/png"));
367 EXPECT_EQ("message", GetIANAMediaType("message/sipfrag"));
368 EXPECT_EQ("model", GetIANAMediaType("model/vrml"));
369 EXPECT_EQ("multipart", GetIANAMediaType("multipart/mixed"));
370 EXPECT_EQ("text", GetIANAMediaType("text/plain"));
371 EXPECT_EQ("video", GetIANAMediaType("video/H261"));
374 TEST(MimeUtilTest
, TestGetExtensionsForMimeType
) {
376 const char* mime_type
;
377 size_t min_expected_size
;
378 const char* contained_result
;
380 { "text/plain", 2, "txt" },
382 { "message/*", 1, "eml" },
383 { "MeSsAge/*", 1, "eml" },
384 { "image/bmp", 1, "bmp" },
385 { "video/*", 6, "mp4" },
386 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_IOS)
387 { "video/*", 6, "mpg" },
389 { "video/*", 6, "mpeg" },
391 { "audio/*", 6, "oga" },
392 { "aUDIo/*", 6, "wav" },
395 for (size_t i
= 0; i
< ARRAYSIZE_UNSAFE(tests
); ++i
) {
396 std::vector
<base::FilePath::StringType
> extensions
;
397 GetExtensionsForMimeType(tests
[i
].mime_type
, &extensions
);
398 ASSERT_TRUE(tests
[i
].min_expected_size
<= extensions
.size());
400 if (!tests
[i
].contained_result
)
404 for (size_t j
= 0; !found
&& j
< extensions
.size(); ++j
) {
406 if (extensions
[j
] == base::UTF8ToWide(tests
[i
].contained_result
))
409 if (extensions
[j
] == tests
[i
].contained_result
)
413 ASSERT_TRUE(found
) << "Must find at least the contained result within "
414 << tests
[i
].mime_type
;
418 TEST(MimeUtilTest
, TestGetCertificateMimeTypeForMimeType
) {
419 EXPECT_EQ(CERTIFICATE_MIME_TYPE_X509_USER_CERT
,
420 GetCertificateMimeTypeForMimeType("application/x-x509-user-cert"));
421 #if defined(OS_ANDROID)
422 // Only Android supports CA Certs and PKCS12 archives.
423 EXPECT_EQ(CERTIFICATE_MIME_TYPE_X509_CA_CERT
,
424 GetCertificateMimeTypeForMimeType("application/x-x509-ca-cert"));
425 EXPECT_EQ(CERTIFICATE_MIME_TYPE_PKCS12_ARCHIVE
,
426 GetCertificateMimeTypeForMimeType("application/x-pkcs12"));
428 EXPECT_EQ(CERTIFICATE_MIME_TYPE_UNKNOWN
,
429 GetCertificateMimeTypeForMimeType("application/x-x509-ca-cert"));
430 EXPECT_EQ(CERTIFICATE_MIME_TYPE_UNKNOWN
,
431 GetCertificateMimeTypeForMimeType("application/x-pkcs12"));
433 EXPECT_EQ(CERTIFICATE_MIME_TYPE_UNKNOWN
,
434 GetCertificateMimeTypeForMimeType("text/plain"));
437 TEST(MimeUtilTest
, TestAddMultipartValueForUpload
) {
438 const char* ref_output
= "--boundary\r\nContent-Disposition: form-data;"
439 " name=\"value name\"\r\nContent-Type: content type"
441 "--boundary\r\nContent-Disposition: form-data;"
442 " name=\"value name\"\r\n\r\nvalue\r\n"
444 std::string post_data
;
445 AddMultipartValueForUpload("value name", "value", "boundary",
446 "content type", &post_data
);
447 AddMultipartValueForUpload("value name", "value", "boundary",
449 AddMultipartFinalDelimiterForUpload("boundary", &post_data
);
450 EXPECT_STREQ(ref_output
, post_data
.c_str());