OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "chrome/browser/download/download_manager.h" | 7 #include "chrome/browser/download/download_manager.h" |
8 #include "chrome/browser/download/download_util.h" | 8 #include "chrome/browser/download/download_util.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 "text/plain", | 57 "text/plain", |
58 L"a_file_name.txt"}, | 58 L"a_file_name.txt"}, |
59 | 59 |
60 // Disposition has parent directories, remove them | 60 // Disposition has parent directories, remove them |
61 {"filename=dir1/dir2/a_file_name.txt", | 61 {"filename=dir1/dir2/a_file_name.txt", |
62 "http://www.evil.com/my_download.txt", | 62 "http://www.evil.com/my_download.txt", |
63 "text/plain", | 63 "text/plain", |
64 L"a_file_name.txt"}, | 64 L"a_file_name.txt"}, |
65 | 65 |
66 // No useful information in disposition or URL, use default | 66 // No useful information in disposition or URL, use default |
67 {"", "http://www.truncated.com/path/", "text/plain", L"download.txt"}, | 67 {"", "http://www.truncated.com/path/", "text/plain", |
| 68 #if defined(OS_LINUX) |
| 69 L"download" |
| 70 #else |
| 71 L"download.txt" |
| 72 #endif |
| 73 }, |
68 | 74 |
69 // A normal avi should get .avi and not .avi.avi | 75 // A normal avi should get .avi and not .avi.avi |
70 {"", "https://blah.google.com/misc/2.avi", "video/x-msvideo", L"2.avi"}, | 76 {"", "https://blah.google.com/misc/2.avi", "video/x-msvideo", L"2.avi"}, |
71 | 77 |
72 // Spaces in the disposition file name | 78 // Spaces in the disposition file name |
73 {"filename=My Downloaded File.exe", | 79 {"filename=My Downloaded File.exe", |
74 "http://www.frontpagehacker.com/a_download.exe", | 80 "http://www.frontpagehacker.com/a_download.exe", |
75 "application/octet-stream", | 81 "application/octet-stream", |
76 L"My Downloaded File.exe"}, | 82 L"My Downloaded File.exe"}, |
77 | 83 |
| 84 // This block tests whether we append extensions based on MIME types; |
| 85 // we don't do this on Linux, so we skip the tests rather than #ifdef |
| 86 // them up. |
| 87 #if !defined(OS_LINUX) |
78 {"filename=my-cat", | 88 {"filename=my-cat", |
79 "http://www.example.com/my-cat", | 89 "http://www.example.com/my-cat", |
80 "image/jpeg", | 90 "image/jpeg", |
81 L"my-cat.jpg"}, | 91 L"my-cat.jpg"}, |
82 | 92 |
83 {"filename=my-cat", | 93 {"filename=my-cat", |
84 "http://www.example.com/my-cat", | 94 "http://www.example.com/my-cat", |
85 "text/plain", | 95 "text/plain", |
86 L"my-cat.txt"}, | 96 L"my-cat.txt"}, |
87 | 97 |
88 {"filename=my-cat", | 98 {"filename=my-cat", |
89 "http://www.example.com/my-cat", | 99 "http://www.example.com/my-cat", |
90 "text/html", | 100 "text/html", |
91 L"my-cat.htm"}, | 101 L"my-cat.htm"}, |
92 | 102 |
93 {"filename=my-cat", | 103 {"filename=my-cat", |
94 "http://www.example.com/my-cat", | 104 "http://www.example.com/my-cat", |
95 "dance/party", | 105 "dance/party", |
96 L"my-cat"}, | 106 L"my-cat"}, |
| 107 #endif // defined(OS_LINUX) |
97 | 108 |
98 {"filename=my-cat.jpg", | 109 {"filename=my-cat.jpg", |
99 "http://www.example.com/my-cat.jpg", | 110 "http://www.example.com/my-cat.jpg", |
100 "text/plain", | 111 "text/plain", |
101 L"my-cat.jpg"}, | 112 L"my-cat.jpg"}, |
102 | 113 |
| 114 // .exe tests. |
| 115 #if defined(OS_WIN) |
103 {"filename=evil.exe", | 116 {"filename=evil.exe", |
104 "http://www.goodguy.com/evil.exe", | 117 "http://www.goodguy.com/evil.exe", |
105 "image/jpeg", | 118 "image/jpeg", |
106 L"evil.jpg"}, | 119 L"evil.jpg"}, |
107 | 120 |
108 {"filename=ok.exe", | 121 {"filename=ok.exe", |
109 "http://www.goodguy.com/ok.exe", | 122 "http://www.goodguy.com/ok.exe", |
110 "binary/octet-stream", | 123 "binary/octet-stream", |
111 L"ok.exe"}, | 124 L"ok.exe"}, |
112 | 125 |
113 {"filename=evil.exe.exe", | 126 {"filename=evil.exe.exe", |
114 "http://www.goodguy.com/evil.exe.exe", | 127 "http://www.goodguy.com/evil.exe.exe", |
115 "dance/party", | 128 "dance/party", |
116 L"evil.exe.download"}, | 129 L"evil.exe.download"}, |
117 | 130 |
118 {"filename=evil.exe", | 131 {"filename=evil.exe", |
119 "http://www.goodguy.com/evil.exe", | 132 "http://www.goodguy.com/evil.exe", |
120 "application/xml", | 133 "application/xml", |
121 L"evil.xml"}, | 134 L"evil.xml"}, |
122 | 135 |
123 {"filename=evil.exe", | 136 {"filename=evil.exe", |
124 "http://www.goodguy.com/evil.exe", | 137 "http://www.goodguy.com/evil.exe", |
125 "application/html+xml", | 138 "application/html+xml", |
126 L"evil.download"}, | 139 L"evil.download"}, |
127 | 140 |
128 {"filename=evil.exe", | 141 {"filename=evil.exe", |
129 "http://www.goodguy.com/evil.exe", | 142 "http://www.goodguy.com/evil.exe", |
130 "application/rss+xml", | 143 "application/rss+xml", |
131 L"evil.download"}, | 144 L"evil.download"}, |
| 145 #endif // OS_WIN |
132 | 146 |
133 {"filename=utils.js", | 147 {"filename=utils.js", |
134 "http://www.goodguy.com/utils.js", | 148 "http://www.goodguy.com/utils.js", |
135 "application/x-javascript", | 149 "application/x-javascript", |
136 L"utils.js"}, | 150 L"utils.js"}, |
137 | 151 |
138 {"filename=contacts.js", | 152 {"filename=contacts.js", |
139 "http://www.goodguy.com/contacts.js", | 153 "http://www.goodguy.com/contacts.js", |
140 "application/json", | 154 "application/json", |
141 L"contacts.js"}, | 155 L"contacts.js"}, |
(...skipping 24 matching lines...) Expand all Loading... |
166 L"program.exe"}, | 180 L"program.exe"}, |
167 | 181 |
168 {"filename=../foo.txt", | 182 {"filename=../foo.txt", |
169 "http://www.evil.com/../foo.txt", | 183 "http://www.evil.com/../foo.txt", |
170 "text/plain", | 184 "text/plain", |
171 L"foo.txt"}, | 185 L"foo.txt"}, |
172 | 186 |
173 {"filename=..\\foo.txt", | 187 {"filename=..\\foo.txt", |
174 "http://www.evil.com/..\\foo.txt", | 188 "http://www.evil.com/..\\foo.txt", |
175 "text/plain", | 189 "text/plain", |
176 L"foo.txt"}, | 190 #if defined(OS_WIN) |
| 191 L"foo.txt" |
| 192 #else |
| 193 L"\\foo.txt" |
| 194 #endif |
| 195 }, |
177 | 196 |
178 {"filename=.hidden", | 197 {"filename=.hidden", |
179 "http://www.evil.com/.hidden", | 198 "http://www.evil.com/.hidden", |
180 "text/plain", | 199 "text/plain", |
181 L"hidden.txt"}, | 200 #if defined(OS_LINUX) |
| 201 L"hidden" |
| 202 #else |
| 203 L"hidden.txt" |
| 204 #endif |
| 205 }, |
182 | 206 |
183 {"filename=trailing.", | 207 {"filename=trailing.", |
184 "http://www.evil.com/trailing.", | 208 "http://www.evil.com/trailing.", |
185 "dance/party", | 209 "dance/party", |
186 L"trailing"}, | 210 L"trailing" |
| 211 }, |
187 | 212 |
188 {"filename=trailing.", | 213 {"filename=trailing.", |
189 "http://www.evil.com/trailing.", | 214 "http://www.evil.com/trailing.", |
190 "text/plain", | 215 "text/plain", |
191 L"trailing.txt"}, | 216 #if defined(OS_LINUX) |
| 217 L"trailing" |
| 218 #else |
| 219 L"trailing.txt" |
| 220 #endif |
| 221 }, |
192 | 222 |
193 {"filename=.", | 223 {"filename=.", |
194 "http://www.evil.com/.", | 224 "http://www.evil.com/.", |
195 "dance/party", | 225 "dance/party", |
196 L"download"}, | 226 L"download"}, |
197 | 227 |
198 {"filename=..", | 228 {"filename=..", |
199 "http://www.evil.com/..", | 229 "http://www.evil.com/..", |
200 "dance/party", | 230 "dance/party", |
201 L"download"}, | 231 L"download"}, |
202 | 232 |
203 {"filename=...", | 233 {"filename=...", |
204 "http://www.evil.com/...", | 234 "http://www.evil.com/...", |
205 "dance/party", | 235 "dance/party", |
206 L"download"}, | 236 L"download"}, |
207 | 237 |
| 238 // Note that this one doesn't have "filename=" on it. |
208 {"a_file_name.txt", | 239 {"a_file_name.txt", |
209 "http://www.evil.com/", | 240 "http://www.evil.com/", |
210 "image/jpeg", | 241 "image/jpeg", |
211 L"download.jpg"}, | 242 #if defined(OS_LINUX) |
| 243 L"download" |
| 244 #else |
| 245 L"download.jpg" |
| 246 #endif |
| 247 }, |
212 | 248 |
213 {"filename=", | 249 {"filename=", |
214 "http://www.evil.com/", | 250 "http://www.evil.com/", |
215 "image/jpeg", | 251 "image/jpeg", |
216 L"download.jpg"}, | 252 #if defined(OS_LINUX) |
| 253 L"download" |
| 254 #else |
| 255 L"download.jpg" |
| 256 #endif |
| 257 }, |
217 | 258 |
218 {"filename=simple", | 259 {"filename=simple", |
219 "http://www.example.com/simple", | 260 "http://www.example.com/simple", |
220 "application/octet-stream", | 261 "application/octet-stream", |
221 L"simple"}, | 262 L"simple"}, |
222 | 263 |
223 {"filename=COM1", | 264 {"filename=COM1", |
224 "http://www.goodguy.com/COM1", | 265 "http://www.goodguy.com/COM1", |
225 "application/foo-bar", | 266 "application/foo-bar", |
226 L"_COM1"}, | 267 #if defined(OS_WIN) |
| 268 L"_COM1" |
| 269 #else |
| 270 L"COM1" |
| 271 #endif |
| 272 }, |
227 | 273 |
228 {"filename=COM4.txt", | 274 {"filename=COM4.txt", |
229 "http://www.goodguy.com/COM4.txt", | 275 "http://www.goodguy.com/COM4.txt", |
230 "text/plain", | 276 "text/plain", |
231 L"_COM4.txt"}, | 277 #if defined(OS_WIN) |
| 278 L"_COM4" |
| 279 #else |
| 280 L"COM4.txt" |
| 281 #endif |
| 282 }, |
232 | 283 |
233 {"filename=lpt1.TXT", | 284 {"filename=lpt1.TXT", |
234 "http://www.goodguy.com/lpt1.TXT", | 285 "http://www.goodguy.com/lpt1.TXT", |
235 "text/plain", | 286 "text/plain", |
236 L"_lpt1.TXT"}, | 287 #if defined(OS_WIN) |
| 288 L"_lpt1.TXT" |
| 289 #else |
| 290 L"lpt1.TXT" |
| 291 #endif |
| 292 }, |
237 | 293 |
238 {"filename=clock$.txt", | 294 {"filename=clock$.txt", |
239 "http://www.goodguy.com/clock$.txt", | 295 "http://www.goodguy.com/clock$.txt", |
240 "text/plain", | 296 "text/plain", |
241 L"_clock$.txt"}, | 297 #if defined(OS_WIN) |
| 298 L"_clock$.txt" |
| 299 #else |
| 300 L"clock$.txt" |
| 301 #endif |
| 302 }, |
242 | 303 |
243 {"filename=mycom1.foo", | 304 {"filename=mycom1.foo", |
244 "http://www.goodguy.com/mycom1.foo", | 305 "http://www.goodguy.com/mycom1.foo", |
245 "text/plain", | 306 "text/plain", |
246 L"mycom1.foo"}, | 307 L"mycom1.foo"}, |
247 | 308 |
248 {"filename=Setup.exe.local", | 309 {"filename=Setup.exe.local", |
249 "http://www.badguy.com/Setup.exe.local", | 310 "http://www.badguy.com/Setup.exe.local", |
250 "application/foo-bar", | 311 "application/foo-bar", |
251 L"Setup.exe.download"}, | 312 #if defined(OS_WIN) |
| 313 L"Setup.exe.download" |
| 314 #else |
| 315 L"Setup.exe.local" |
| 316 #endif |
| 317 }, |
252 | 318 |
253 {"filename=Setup.exe.local.local", | 319 {"filename=Setup.exe.local.local", |
254 "http://www.badguy.com/Setup.exe.local", | 320 "http://www.badguy.com/Setup.exe.local", |
255 "application/foo-bar", | 321 "application/foo-bar", |
256 L"Setup.exe.local.download"}, | 322 #if defined(OS_WIN) |
| 323 L"Setup.exe.local.download" |
| 324 #else |
| 325 L"Setup.exe.local.local" |
| 326 #endif |
| 327 }, |
257 | 328 |
258 {"filename=Setup.exe.lnk", | 329 {"filename=Setup.exe.lnk", |
259 "http://www.badguy.com/Setup.exe.lnk", | 330 "http://www.badguy.com/Setup.exe.lnk", |
260 "application/foo-bar", | 331 "application/foo-bar", |
261 L"Setup.exe.download"}, | 332 #if defined(OS_WIN) |
| 333 L"Setup.exe.download" |
| 334 #else |
| 335 L"Setup.exe.lnk" |
| 336 #endif |
| 337 }, |
262 | 338 |
263 {"filename=Desktop.ini", | 339 {"filename=Desktop.ini", |
264 "http://www.badguy.com/Desktop.ini", | 340 "http://www.badguy.com/Desktop.ini", |
265 "application/foo-bar", | 341 "application/foo-bar", |
266 L"_Desktop.ini"}, | 342 #if defined(OS_WIN) |
| 343 L"_Desktop.ini" |
| 344 #else |
| 345 L"Desktop.ini" |
| 346 #endif |
| 347 }, |
267 | 348 |
268 {"filename=Thumbs.db", | 349 {"filename=Thumbs.db", |
269 "http://www.badguy.com/Thumbs.db", | 350 "http://www.badguy.com/Thumbs.db", |
270 "application/foo-bar", | 351 "application/foo-bar", |
271 L"_Thumbs.db"}, | 352 #if defined(OS_WIN) |
| 353 L"_Thumbs.db" |
| 354 #else |
| 355 L"Thumbs.db" |
| 356 #endif |
| 357 }, |
272 | 358 |
273 {"filename=source.srf", | 359 {"filename=source.srf", |
274 "http://www.hotmail.com", | 360 "http://www.hotmail.com", |
275 "image/jpeg", | 361 "image/jpeg", |
276 L"source.srf.jpg"}, | 362 #if defined(OS_WIN) |
| 363 L"source.srf.jpg" |
| 364 #else |
| 365 L"source.srf" |
| 366 #endif |
| 367 }, |
277 | 368 |
278 {"filename=source.jpg", | 369 {"filename=source.jpg", |
279 "http://www.hotmail.com", | 370 "http://www.hotmail.com", |
280 "application/x-javascript", | 371 "application/x-javascript", |
281 L"source.jpg"}, | 372 L"source.jpg"}, |
282 | 373 |
283 // NetUtilTest.{GetSuggestedFilename, GetFileNameFromCD} test these | 374 // NetUtilTest.{GetSuggestedFilename, GetFileNameFromCD} test these |
284 // more thoroughly. Tested below are a small set of samples. | 375 // more thoroughly. Tested below are a small set of samples. |
285 {"attachment; filename=\"%EC%98%88%EC%88%A0%20%EC%98%88%EC%88%A0.jpg\"", | 376 {"attachment; filename=\"%EC%98%88%EC%88%A0%20%EC%98%88%EC%88%A0.jpg\"", |
286 "http://www.examples.com/", | 377 "http://www.examples.com/", |
287 "image/jpeg", | 378 "image/jpeg", |
288 L"\uc608\uc220 \uc608\uc220.jpg"}, | 379 L"\uc608\uc220 \uc608\uc220.jpg"}, |
289 | 380 |
290 {"attachment; name=abc de.pdf", | 381 {"attachment; name=abc de.pdf", |
291 "http://www.examples.com/q.cgi?id=abc", | 382 "http://www.examples.com/q.cgi?id=abc", |
292 "application/octet-stream", | 383 "application/octet-stream", |
293 L"abc de.pdf"}, | 384 L"abc de.pdf"}, |
294 | 385 |
295 {"filename=\"=?EUC-JP?Q?=B7=DD=BD=D13=2Epng?=\"", | 386 {"filename=\"=?EUC-JP?Q?=B7=DD=BD=D13=2Epng?=\"", |
296 "http://www.example.com/path", | 387 "http://www.example.com/path", |
297 "image/png", | 388 "image/png", |
298 L"\x82b8\x8853" L"3.png"}, | 389 L"\x82b8\x8853" L"3.png"}, |
299 | 390 |
300 // The following two have invalid CD headers and filenames come | 391 // The following two have invalid CD headers and filenames come |
301 // from the URL. | 392 // from the URL. |
302 {"attachment; filename==?iiso88591?Q?caf=EG?=", | 393 {"attachment; filename==?iiso88591?Q?caf=EG?=", |
303 "http://www.example.com/test%20123", | 394 "http://www.example.com/test%20123", |
304 "image/jpeg", | 395 "image/jpeg", |
305 L"test 123.jpg"}, | 396 #if defined(OS_LINUX) |
| 397 L"test 123" |
| 398 #else |
| 399 L"test 123.jpg" |
| 400 #endif |
| 401 }, |
306 | 402 |
307 {"malformed_disposition", | 403 {"malformed_disposition", |
308 "http://www.google.com/%EC%98%88%EC%88%A0%20%EC%98%88%EC%88%A0.jpg", | 404 "http://www.google.com/%EC%98%88%EC%88%A0%20%EC%98%88%EC%88%A0.jpg", |
309 "image/jpeg", | 405 "image/jpeg", |
310 L"\uc608\uc220 \uc608\uc220.jpg"}, | 406 L"\uc608\uc220 \uc608\uc220.jpg"}, |
311 | 407 |
312 // Invalid C-D. No filename from URL. Falls back to 'download'. | 408 // Invalid C-D. No filename from URL. Falls back to 'download'. |
313 {"attachment; filename==?iso88591?Q?caf=E3?", | 409 {"attachment; filename==?iso88591?Q?caf=E3?", |
314 "http://www.google.com/path1/path2/", | 410 "http://www.google.com/path1/path2/", |
315 "image/jpeg", | 411 "image/jpeg", |
316 L"download.jpg"}, | 412 #if defined(OS_LINUX) |
| 413 L"download" |
| 414 #else |
| 415 L"download.jpg" |
| 416 #endif |
| 417 }, |
317 | 418 |
318 // Issue=5772. | 419 // Issue=5772. |
319 {"", | 420 {"", |
320 "http://www.example.com/foo.tar.gz", | 421 "http://www.example.com/foo.tar.gz", |
321 "application/x-tar", | 422 "application/x-tar", |
322 L"foo.tar.gz"}, | 423 L"foo.tar.gz"}, |
323 | 424 |
324 // Issue=7337. | 425 // Issue=7337. |
325 {"", | 426 {"", |
326 "http://maged.lordaeron.org/blank.reg", | 427 "http://maged.lordaeron.org/blank.reg", |
327 "text/x-registry", | 428 "text/x-registry", |
328 L"blank.reg"}, | 429 L"blank.reg"}, |
329 | 430 |
330 {"", | 431 {"", |
331 "http://www.example.com/bar.tar", | 432 "http://www.example.com/bar.tar", |
332 "application/x-tar", | 433 "application/x-tar", |
333 L"bar.tar"}, | 434 L"bar.tar"}, |
334 | 435 |
335 {"", | 436 {"", |
336 "http://www.example.com/bar.bogus", | 437 "http://www.example.com/bar.bogus", |
337 "application/x-tar", | 438 "application/x-tar", |
338 L"bar.bogus.tar"}, | 439 #if defined(OS_LINUX) |
| 440 L"bar.bogus" |
| 441 #else |
| 442 L"bar.bogus.tar" |
| 443 #endif |
| 444 }, |
339 | 445 |
| 446 // http://code.google.com/p/chromium/issues/detail?id=20337 |
| 447 {"filename=.download.txt", |
| 448 "http://www.example.com/.download.txt", |
| 449 "text/plain", |
| 450 L"download.txt"}, |
340 }; | 451 }; |
341 | 452 |
342 } // namespace | 453 } // namespace |
343 | 454 |
344 // Tests to ensure that the file names we generate from hints from the server | 455 // Tests to ensure that the file names we generate from hints from the server |
345 // (content-disposition, URL name, etc) don't cause security holes. | 456 // (content-disposition, URL name, etc) don't cause security holes. |
346 TEST_F(DownloadManagerTest, TestDownloadFilename) { | 457 TEST_F(DownloadManagerTest, TestDownloadFilename) { |
347 std::wstring file_name; | 458 std::wstring file_name; |
348 for (int i = 0; i < arraysize(kGeneratedFiles); ++i) { | 459 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kGeneratedFiles); ++i) { |
349 GetGeneratedFilename(kGeneratedFiles[i].disposition, | 460 GetGeneratedFilename(kGeneratedFiles[i].disposition, |
350 kGeneratedFiles[i].url, | 461 kGeneratedFiles[i].url, |
351 kGeneratedFiles[i].mime_type, | 462 kGeneratedFiles[i].mime_type, |
352 "", | 463 "", |
353 &file_name); | 464 &file_name); |
354 EXPECT_EQ(kGeneratedFiles[i].expected_name, file_name); | 465 EXPECT_EQ(kGeneratedFiles[i].expected_name, file_name); |
355 GetGeneratedFilename(kGeneratedFiles[i].disposition, | 466 GetGeneratedFilename(kGeneratedFiles[i].disposition, |
356 kGeneratedFiles[i].url, | 467 kGeneratedFiles[i].url, |
357 kGeneratedFiles[i].mime_type, | 468 kGeneratedFiles[i].mime_type, |
358 "GBK", | 469 "GBK", |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 { FILE_PATH_LITERAL("C:\\foo\\con.htm"), | 524 { FILE_PATH_LITERAL("C:\\foo\\con.htm"), |
414 "text/html", | 525 "text/html", |
415 FILE_PATH_LITERAL("C:\\foo\\_con.htm") }, | 526 FILE_PATH_LITERAL("C:\\foo\\_con.htm") }, |
416 { FILE_PATH_LITERAL("C:\\foo\\con"), | 527 { FILE_PATH_LITERAL("C:\\foo\\con"), |
417 "text/html", | 528 "text/html", |
418 FILE_PATH_LITERAL("C:\\foo\\_con.htm") }, | 529 FILE_PATH_LITERAL("C:\\foo\\_con.htm") }, |
419 }; | 530 }; |
420 | 531 |
421 } // namespace | 532 } // namespace |
422 | 533 |
| 534 #if defined(OS_WIN) |
| 535 // TODO(port): port to non-Windows. |
423 TEST_F(DownloadManagerTest, GetSafeFilename) { | 536 TEST_F(DownloadManagerTest, GetSafeFilename) { |
424 for (int i = 0; i < arraysize(kSafeFilenameCases); ++i) { | 537 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kSafeFilenameCases); ++i) { |
425 FilePath path(kSafeFilenameCases[i].path); | 538 FilePath path(kSafeFilenameCases[i].path); |
426 download_manager_->GenerateSafeFilename(kSafeFilenameCases[i].mime_type, | 539 download_manager_->GenerateSafeFilename(kSafeFilenameCases[i].mime_type, |
427 &path); | 540 &path); |
428 EXPECT_EQ(kSafeFilenameCases[i].expected_path, path.value()); | 541 EXPECT_EQ(kSafeFilenameCases[i].expected_path, path.value()); |
429 } | 542 } |
430 } | 543 } |
| 544 #endif // OS_WIN |
OLD | NEW |