| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_content_disposition.h" | 5 #include "net/http/http_content_disposition.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 "", L"\x82b8\x8853" L"3.png"}, | 140 "", L"\x82b8\x8853" L"3.png"}, |
| 141 {"attachment; filename*=utf-8''" | 141 {"attachment; filename*=utf-8''" |
| 142 "%E8%8A%B8%E8%A1%93%203%2Epng", "", L"\x82b8\x8853 3.png"}, | 142 "%E8%8A%B8%E8%A1%93%203%2Epng", "", L"\x82b8\x8853 3.png"}, |
| 143 {"attachment; filename*=utf-8''%F0%90%8C%B0 3.png", "", | 143 {"attachment; filename*=utf-8''%F0%90%8C%B0 3.png", "", |
| 144 L"\U00010330 3.png"}, | 144 L"\U00010330 3.png"}, |
| 145 {"inline; filename*=Euc-Kr'ko'%BF%B9%BC%FA%2Epng", "", | 145 {"inline; filename*=Euc-Kr'ko'%BF%B9%BC%FA%2Epng", "", |
| 146 L"\xc608\xc220.png"}, | 146 L"\xc608\xc220.png"}, |
| 147 {"attachment; filename*=windows-1252''caf%E9.png", "", | 147 {"attachment; filename*=windows-1252''caf%E9.png", "", |
| 148 L"caf\x00e9.png"}, | 148 L"caf\x00e9.png"}, |
| 149 | 149 |
| 150 // Multiple filename, filename*, name parameters specified. |
| 151 {"attachment; name=\"foo\"; filename=\"bar\"", "", L"bar"}, |
| 152 {"attachment; filename=\"bar\"; name=\"foo\"", "", L"bar"}, |
| 153 {"attachment; filename=\"bar\"; filename*=utf-8''baz", "", L"baz"}, |
| 154 |
| 150 // http://greenbytes.de/tech/tc2231/ filename* test cases. | 155 // http://greenbytes.de/tech/tc2231/ filename* test cases. |
| 151 // attwithisofn2231iso | 156 // attwithisofn2231iso |
| 152 {"attachment; filename*=iso-8859-1''foo-%E4.html", "", | 157 {"attachment; filename*=iso-8859-1''foo-%E4.html", "", |
| 153 L"foo-\xe4.html"}, | 158 L"foo-\xe4.html"}, |
| 154 // attwithfn2231utf8 | 159 // attwithfn2231utf8 |
| 155 {"attachment; filename*=" | 160 {"attachment; filename*=" |
| 156 "UTF-8''foo-%c3%a4-%e2%82%ac.html", "", L"foo-\xe4-\x20ac.html"}, | 161 "UTF-8''foo-%c3%a4-%e2%82%ac.html", "", L"foo-\xe4-\x20ac.html"}, |
| 157 // attwithfn2231noc : no encoding specified but UTF-8 is used. | 162 // attwithfn2231noc : no encoding specified but UTF-8 is used. |
| 158 {"attachment; filename*=''foo-%c3%a4-%e2%82%ac.html", | 163 {"attachment; filename*=''foo-%c3%a4-%e2%82%ac.html", |
| 159 "", L""}, | 164 "", L""}, |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 506 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
| 502 HttpContentDisposition header(tests[i].header, std::string()); | 507 HttpContentDisposition header(tests[i].header, std::string()); |
| 503 EXPECT_EQ(tests[i].expected_type, header.type()) | 508 EXPECT_EQ(tests[i].expected_type, header.type()) |
| 504 << "Failed on input: " << tests[i].header; | 509 << "Failed on input: " << tests[i].header; |
| 505 EXPECT_EQ(tests[i].expected_filename, UTF8ToWide(header.filename())) | 510 EXPECT_EQ(tests[i].expected_filename, UTF8ToWide(header.filename())) |
| 506 << "Failed on input: " << tests[i].header; | 511 << "Failed on input: " << tests[i].header; |
| 507 } | 512 } |
| 508 } | 513 } |
| 509 | 514 |
| 510 } // namespace net | 515 } // namespace net |
| OLD | NEW |