summaryrefslogtreecommitdiffstats
path: root/net/http/http_content_disposition_unittest.cc
diff options
context:
space:
mode:
authorttuttle <ttuttle@chromium.org>2015-04-23 12:42:29 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-23 19:42:48 +0000
commit859dc7ae4fac28a22afc10d62c7eb8d8fb2ef7f3 (patch)
tree0aaf024ced03282e40b46786570f2a821c015865 /net/http/http_content_disposition_unittest.cc
parent77137323157640d3eecae553956425c067054383 (diff)
downloadchromium_src-859dc7ae4fac28a22afc10d62c7eb8d8fb2ef7f3.zip
chromium_src-859dc7ae4fac28a22afc10d62c7eb8d8fb2ef7f3.tar.gz
chromium_src-859dc7ae4fac28a22afc10d62c7eb8d8fb2ef7f3.tar.bz2
net cleanup: Remove unnecessary namespace prefixes.
BUG=475208 Review URL: https://codereview.chromium.org/1095823003 Cr-Commit-Position: refs/heads/master@{#326610}
Diffstat (limited to 'net/http/http_content_disposition_unittest.cc')
-rw-r--r--net/http/http_content_disposition_unittest.cc518
1 files changed, 231 insertions, 287 deletions
diff --git a/net/http/http_content_disposition_unittest.cc b/net/http/http_content_disposition_unittest.cc
index e617c6c..ade0d29 100644
--- a/net/http/http_content_disposition_unittest.cc
+++ b/net/http/http_content_disposition_unittest.cc
@@ -207,301 +207,245 @@ TEST(HttpContentDispositionTest, Filename) {
TEST(HttpContentDispositionTest, tc2231) {
const struct FileNameCDCase {
const char* header;
- net::HttpContentDisposition::Type expected_type;
+ HttpContentDisposition::Type expected_type;
const wchar_t* expected_filename;
} tests[] = {
- // http://greenbytes.de/tech/tc2231/#inlonly
- { "inline",
- net::HttpContentDisposition::INLINE,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#inlonlyquoted
- { "\"inline\"",
- net::HttpContentDisposition::INLINE,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#inlwithasciifilename
- { "inline; filename=\"foo.html\"",
- net::HttpContentDisposition::INLINE,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#inlwithfnattach
- { "inline; filename=\"Not an attachment!\"",
- net::HttpContentDisposition::INLINE,
- L"Not an attachment!"
- },
- // http://greenbytes.de/tech/tc2231/#inlwithasciifilenamepdf
- { "inline; filename=\"foo.pdf\"",
- net::HttpContentDisposition::INLINE,
- L"foo.pdf"
- },
- // http://greenbytes.de/tech/tc2231/#attonly
- { "attachment",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attonlyquoted
- { "\"attachment\"",
- net::HttpContentDisposition::INLINE,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attonly403
- // TODO(abarth): This isn't testable in this unit test.
- // http://greenbytes.de/tech/tc2231/#attonlyucase
- { "ATTACHMENT",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifilename
- { "attachment; filename=\"foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifnescapedchar
- { "attachment; filename=\"f\\oo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifnescapedquote
- { "attachment; filename=\"\\\"quoting\\\" tested.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"\"quoting\" tested.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithquotedsemicolon
- { "attachment; filename=\"Here's a semicolon;.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"Here's a semicolon;.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithfilenameandextparam
- { "attachment; foo=\"bar\"; filename=\"foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithfilenameandextparamescaped
- { "attachment; foo=\"\\\"\\\\\";filename=\"foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifilenameucase
- { "attachment; FILENAME=\"foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifilenamenq
- { "attachment; filename=foo.html",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifilenamenqs
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo.html ;",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attemptyparam
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; ;filename=foo",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifilenamenqws
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo bar.html",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo bar.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithfntokensq
- { "attachment; filename='foo.bar'",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.bar" // Should be L"'foo.bar'"
- },
+ // http://greenbytes.de/tech/tc2231/#inlonly
+ {"inline", HttpContentDisposition::INLINE, L""},
+ // http://greenbytes.de/tech/tc2231/#inlonlyquoted
+ {"\"inline\"", HttpContentDisposition::INLINE, L""},
+ // http://greenbytes.de/tech/tc2231/#inlwithasciifilename
+ {"inline; filename=\"foo.html\"",
+ HttpContentDisposition::INLINE,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#inlwithfnattach
+ {"inline; filename=\"Not an attachment!\"",
+ HttpContentDisposition::INLINE,
+ L"Not an attachment!"},
+ // http://greenbytes.de/tech/tc2231/#inlwithasciifilenamepdf
+ {"inline; filename=\"foo.pdf\"",
+ HttpContentDisposition::INLINE,
+ L"foo.pdf"},
+ // http://greenbytes.de/tech/tc2231/#attonly
+ {"attachment", HttpContentDisposition::ATTACHMENT, L""},
+ // http://greenbytes.de/tech/tc2231/#attonlyquoted
+ {"\"attachment\"", HttpContentDisposition::INLINE, L""},
+ // http://greenbytes.de/tech/tc2231/#attonly403
+ // TODO(abarth): This isn't testable in this unit test.
+ // http://greenbytes.de/tech/tc2231/#attonlyucase
+ {"ATTACHMENT", HttpContentDisposition::ATTACHMENT, L""},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifilename
+ {"attachment; filename=\"foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifnescapedchar
+ {"attachment; filename=\"f\\oo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifnescapedquote
+ {"attachment; filename=\"\\\"quoting\\\" tested.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"\"quoting\" tested.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithquotedsemicolon
+ {"attachment; filename=\"Here's a semicolon;.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"Here's a semicolon;.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithfilenameandextparam
+ {"attachment; foo=\"bar\"; filename=\"foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithfilenameandextparamescaped
+ {"attachment; foo=\"\\\"\\\\\";filename=\"foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifilenameucase
+ {"attachment; FILENAME=\"foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifilenamenq
+ {"attachment; filename=foo.html",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifilenamenqs
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo.html ;",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attemptyparam
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; ;filename=foo", HttpContentDisposition::ATTACHMENT, L"foo"},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifilenamenqws
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo bar.html",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo bar.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithfntokensq
+ {
+ "attachment; filename='foo.bar'",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.bar" // Should be L"'foo.bar'"
+ },
#ifdef ICU_SHOULD_FAIL_CONVERSION_ON_INVALID_CHARACTER
- // http://greenbytes.de/tech/tc2231/#attwithisofnplain
- { "attachment; filename=\"foo-\xE4html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"" // Should be L"foo-\xE4.html"
- },
+ // http://greenbytes.de/tech/tc2231/#attwithisofnplain
+ {
+ "attachment; filename=\"foo-\xE4html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"" // Should be L"foo-\xE4.html"
+ },
#endif
- // http://greenbytes.de/tech/tc2231/#attwithutf8fnplain
- // Note: We'll UTF-8 decode the file name, even though tc2231 says not to.
- { "attachment; filename=\"foo-\xC3\xA4.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo-\xE4.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithfnrawpctenca
- { "attachment; filename=\"foo-%41.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo-A.html" // Should be L"foo-%41.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithfnusingpct
- { "attachment; filename=\"50%.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"50%.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithfnrawpctencaq
- { "attachment; filename=\"foo-%\\41.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo-A.html" // Should be L"foo-%41.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithnamepct
- { "attachment; name=\"foo-%41.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo-A.html" // Should be L"foo-%41.html"
- },
+ // http://greenbytes.de/tech/tc2231/#attwithutf8fnplain
+ // Note: We'll UTF-8 decode the file name, even though tc2231 says not to.
+ {"attachment; filename=\"foo-\xC3\xA4.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo-\xE4.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithfnrawpctenca
+ {
+ "attachment; filename=\"foo-%41.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo-A.html" // Should be L"foo-%41.html"
+ },
+ // http://greenbytes.de/tech/tc2231/#attwithfnusingpct
+ {"attachment; filename=\"50%.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"50%.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithfnrawpctencaq
+ {
+ "attachment; filename=\"foo-%\\41.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo-A.html" // Should be L"foo-%41.html"
+ },
+ // http://greenbytes.de/tech/tc2231/#attwithnamepct
+ {
+ "attachment; name=\"foo-%41.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo-A.html" // Should be L"foo-%41.html"
+ },
#ifdef ICU_SHOULD_FAIL_CONVERSION_ON_INVALID_CHARACTER
- // http://greenbytes.de/tech/tc2231/#attwithfilenamepctandiso
- { "attachment; filename=\"\xE4-%41.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"" // Should be L"\xE4-%41.htm"
- },
+ // http://greenbytes.de/tech/tc2231/#attwithfilenamepctandiso
+ {
+ "attachment; filename=\"\xE4-%41.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"" // Should be L"\xE4-%41.htm"
+ },
#endif
- // http://greenbytes.de/tech/tc2231/#attwithfnrawpctenclong
- { "attachment; filename=\"foo-%c3%a4-%e2%82%ac.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo-\xE4-\u20AC.html" // Should be L"foo-%c3%a4-%e2%82%ac.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifilenamews1
- { "attachment; filename =\"foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwith2filenames
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=\"foo.html\"; filename=\"bar.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attfnbrokentoken
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo[1](2).html",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo[1](2).html"
- },
+ // http://greenbytes.de/tech/tc2231/#attwithfnrawpctenclong
+ {
+ "attachment; filename=\"foo-%c3%a4-%e2%82%ac.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo-\xE4-\u20AC.html" // Should be L"foo-%c3%a4-%e2%82%ac.html"
+ },
+ // http://greenbytes.de/tech/tc2231/#attwithasciifilenamews1
+ {"attachment; filename =\"foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwith2filenames
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=\"foo.html\"; filename=\"bar.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attfnbrokentoken
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo[1](2).html",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo[1](2).html"},
#ifdef ICU_SHOULD_FAIL_CONVERSION_ON_INVALID_CHARACTER
- // http://greenbytes.de/tech/tc2231/#attfnbrokentokeniso
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo-\xE4.html",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
+ // http://greenbytes.de/tech/tc2231/#attfnbrokentokeniso
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo-\xE4.html",
+ HttpContentDisposition::ATTACHMENT,
+ L""},
#endif
- // http://greenbytes.de/tech/tc2231/#attfnbrokentokenutf
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo-\xC3\xA4.html",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo-\xE4.html"
- },
- // http://greenbytes.de/tech/tc2231/#attmissingdisposition
- // Note: tc2231 says we should fail to parse this header.
- { "filename=foo.html",
- net::HttpContentDisposition::INLINE,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attmissingdisposition2
- // Note: tc2231 says we should fail to parse this header.
- { "x=y; filename=foo.html",
- net::HttpContentDisposition::INLINE,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attmissingdisposition3
- // Note: tc2231 says we should fail to parse this header.
- { "\"foo; filename=bar;baz\"; filename=qux",
- net::HttpContentDisposition::INLINE,
- L"" // Firefox gets qux
- },
- // http://greenbytes.de/tech/tc2231/#attmissingdisposition4
- // Note: tc2231 says we should fail to parse this header.
- { "filename=foo.html, filename=bar.html",
- net::HttpContentDisposition::INLINE,
- L"foo.html, filename=bar.html"
- },
- // http://greenbytes.de/tech/tc2231/#emptydisposition
- // Note: tc2231 says we should fail to parse this header.
- { "; filename=foo.html",
- net::HttpContentDisposition::INLINE,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attandinline
- // Note: tc2231 says we should fail to parse this header.
- { "inline; attachment; filename=foo.html",
- net::HttpContentDisposition::INLINE,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attandinline2
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; inline; filename=foo.html",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attbrokenquotedfn
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=\"foo.html\".txt",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html\".txt"
- },
- // http://greenbytes.de/tech/tc2231/#attbrokenquotedfn2
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=\"bar",
- net::HttpContentDisposition::ATTACHMENT,
- L"bar"
- },
- // http://greenbytes.de/tech/tc2231/#attbrokenquotedfn3
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo\"bar;baz\"qux",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo\"bar;baz\"qux"
- },
- // http://greenbytes.de/tech/tc2231/#attmultinstances
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo.html, attachment; filename=bar.html",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html, attachment"
- },
- // http://greenbytes.de/tech/tc2231/#attmissingdelim
- { "attachment; foo=foo filename=bar",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attreversed
- // Note: tc2231 says we should fail to parse this header.
- { "filename=foo.html; attachment",
- net::HttpContentDisposition::INLINE,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attconfusedparam
- { "attachment; xfilename=foo.html",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attabspath
- { "attachment; filename=\"/foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"/foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attabspathwin
- { "attachment; filename=\"\\\\foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"\\foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#dispext
- { "foobar",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#dispextbadfn
- { "attachment; example=\"filename=example.txt\"",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attnewandfn
- { "attachment; foobar=x; filename=\"foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // TODO(abarth): Add the filename* tests, but check
- // HttpContentDispositionTest.Filename for overlap.
- // TODO(abarth): http://greenbytes.de/tech/tc2231/#attrfc2047token
- // TODO(abarth): http://greenbytes.de/tech/tc2231/#attrfc2047quoted
+ // http://greenbytes.de/tech/tc2231/#attfnbrokentokenutf
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo-\xC3\xA4.html",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo-\xE4.html"},
+ // http://greenbytes.de/tech/tc2231/#attmissingdisposition
+ // Note: tc2231 says we should fail to parse this header.
+ {"filename=foo.html", HttpContentDisposition::INLINE, L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attmissingdisposition2
+ // Note: tc2231 says we should fail to parse this header.
+ {"x=y; filename=foo.html", HttpContentDisposition::INLINE, L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attmissingdisposition3
+ // Note: tc2231 says we should fail to parse this header.
+ {
+ "\"foo; filename=bar;baz\"; filename=qux",
+ HttpContentDisposition::INLINE,
+ L"" // Firefox gets qux
+ },
+ // http://greenbytes.de/tech/tc2231/#attmissingdisposition4
+ // Note: tc2231 says we should fail to parse this header.
+ {"filename=foo.html, filename=bar.html",
+ HttpContentDisposition::INLINE,
+ L"foo.html, filename=bar.html"},
+ // http://greenbytes.de/tech/tc2231/#emptydisposition
+ // Note: tc2231 says we should fail to parse this header.
+ {"; filename=foo.html", HttpContentDisposition::INLINE, L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attandinline
+ // Note: tc2231 says we should fail to parse this header.
+ {"inline; attachment; filename=foo.html",
+ HttpContentDisposition::INLINE,
+ L""},
+ // http://greenbytes.de/tech/tc2231/#attandinline2
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; inline; filename=foo.html",
+ HttpContentDisposition::ATTACHMENT,
+ L""},
+ // http://greenbytes.de/tech/tc2231/#attbrokenquotedfn
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=\"foo.html\".txt",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html\".txt"},
+ // http://greenbytes.de/tech/tc2231/#attbrokenquotedfn2
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=\"bar",
+ HttpContentDisposition::ATTACHMENT,
+ L"bar"},
+ // http://greenbytes.de/tech/tc2231/#attbrokenquotedfn3
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo\"bar;baz\"qux",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo\"bar;baz\"qux"},
+ // http://greenbytes.de/tech/tc2231/#attmultinstances
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo.html, attachment; filename=bar.html",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html, attachment"},
+ // http://greenbytes.de/tech/tc2231/#attmissingdelim
+ {"attachment; foo=foo filename=bar",
+ HttpContentDisposition::ATTACHMENT,
+ L""},
+ // http://greenbytes.de/tech/tc2231/#attreversed
+ // Note: tc2231 says we should fail to parse this header.
+ {"filename=foo.html; attachment",
+ HttpContentDisposition::INLINE,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attconfusedparam
+ {"attachment; xfilename=foo.html",
+ HttpContentDisposition::ATTACHMENT,
+ L""},
+ // http://greenbytes.de/tech/tc2231/#attabspath
+ {"attachment; filename=\"/foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"/foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attabspathwin
+ {"attachment; filename=\"\\\\foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"\\foo.html"},
+ // http://greenbytes.de/tech/tc2231/#dispext
+ {"foobar", HttpContentDisposition::ATTACHMENT, L""},
+ // http://greenbytes.de/tech/tc2231/#dispextbadfn
+ {"attachment; example=\"filename=example.txt\"",
+ HttpContentDisposition::ATTACHMENT,
+ L""},
+ // http://greenbytes.de/tech/tc2231/#attnewandfn
+ {"attachment; foobar=x; filename=\"foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // TODO(abarth): Add the filename* tests, but check
+ // HttpContentDispositionTest.Filename for overlap.
+ // TODO(abarth): http://greenbytes.de/tech/tc2231/#attrfc2047token
+ // TODO(abarth): http://greenbytes.de/tech/tc2231/#attrfc2047quoted
};
for (size_t i = 0; i < arraysize(tests); ++i) {
HttpContentDisposition header(tests[i].header, std::string());