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

Side by Side Diff: trunk/src/base/files/file_path_unittest.cc

Issue 15095015: Revert 200603 "Make Windows traversal checking handle pathologic..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
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 #include "testing/platform_test.h" 9 #include "testing/platform_test.h"
10 10
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 const struct UnaryBooleanTestData cases[] = { 394 const struct UnaryBooleanTestData cases[] = {
395 { FPL(""), false }, 395 { FPL(""), false },
396 { FPL("a"), false }, 396 { FPL("a"), false },
397 { FPL("c:"), false }, 397 { FPL("c:"), false },
398 { FPL("c:a"), false }, 398 { FPL("c:a"), false },
399 { FPL("a/b"), false }, 399 { FPL("a/b"), false },
400 { FPL("//"), true }, 400 { FPL("//"), true },
401 { FPL("//a"), true }, 401 { FPL("//a"), true },
402 { FPL("c:a/b"), false }, 402 { FPL("c:a/b"), false },
403 { FPL("?:/a"), false }, 403 { FPL("?:/a"), false },
404 { FPL("/.. "), false },
405 { FPL("/ .."), false },
406 { FPL("/..."), false },
407 #if defined(FILE_PATH_USES_DRIVE_LETTERS) 404 #if defined(FILE_PATH_USES_DRIVE_LETTERS)
408 { FPL("/"), false }, 405 { FPL("/"), false },
409 { FPL("/a"), false }, 406 { FPL("/a"), false },
410 { FPL("/."), false }, 407 { FPL("/."), false },
411 { FPL("/.."), false }, 408 { FPL("/.."), false },
412 { FPL("c:/"), true }, 409 { FPL("c:/"), true },
413 { FPL("c:/a"), true }, 410 { FPL("c:/a"), true },
414 { FPL("c:/."), true }, 411 { FPL("c:/."), true },
415 { FPL("c:/.."), true }, 412 { FPL("c:/.."), true },
416 { FPL("C:/a"), true }, 413 { FPL("C:/a"), true },
417 { FPL("d:/a"), true }, 414 { FPL("d:/a"), true },
418 #else // FILE_PATH_USES_DRIVE_LETTERS 415 #else // FILE_PATH_USES_DRIVE_LETTERS
419 { FPL("/"), true }, 416 { FPL("/"), true },
420 { FPL("/a"), true }, 417 { FPL("/a"), true },
421 { FPL("/."), true }, 418 { FPL("/."), true },
422 { FPL("/.."), true }, 419 { FPL("/.."), true },
423 { FPL("c:/"), false }, 420 { FPL("c:/"), false },
424 #endif // FILE_PATH_USES_DRIVE_LETTERS 421 #endif // FILE_PATH_USES_DRIVE_LETTERS
425 #if defined(FILE_PATH_USES_WIN_SEPARATORS) 422 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
426 { FPL("a\\b"), false }, 423 { FPL("a\\b"), false },
427 { FPL("\\\\"), true }, 424 { FPL("\\\\"), true },
428 { FPL("\\\\a"), true }, 425 { FPL("\\\\a"), true },
429 { FPL("a\\b"), false }, 426 { FPL("a\\b"), false },
430 { FPL("\\\\"), true }, 427 { FPL("\\\\"), true },
431 { FPL("//a"), true }, 428 { FPL("//a"), true },
432 { FPL("c:a\\b"), false }, 429 { FPL("c:a\\b"), false },
433 { FPL("?:\\a"), false }, 430 { FPL("?:\\a"), false },
434 { FPL("\\.. "), false },
435 { FPL("\\ .."), false },
436 { FPL("\\..."), false },
437 #if defined(FILE_PATH_USES_DRIVE_LETTERS) 431 #if defined(FILE_PATH_USES_DRIVE_LETTERS)
438 { FPL("\\"), false }, 432 { FPL("\\"), false },
439 { FPL("\\a"), false }, 433 { FPL("\\a"), false },
440 { FPL("\\."), false }, 434 { FPL("\\."), false },
441 { FPL("\\.."), false }, 435 { FPL("\\.."), false },
442 { FPL("c:\\"), true }, 436 { FPL("c:\\"), true },
443 { FPL("c:\\"), true }, 437 { FPL("c:\\"), true },
444 { FPL("c:\\a"), true }, 438 { FPL("c:\\a"), true },
445 { FPL("c:\\."), true }, 439 { FPL("c:\\."), true },
446 { FPL("c:\\.."), true }, 440 { FPL("c:\\.."), true },
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 { FPL("foo/"), FPL("foo/") } 1219 { FPL("foo/"), FPL("foo/") }
1226 }; 1220 };
1227 for (size_t i = 0; i < arraysize(cases); ++i) { 1221 for (size_t i = 0; i < arraysize(cases); ++i) {
1228 FilePath input = FilePath(cases[i].input).NormalizePathSeparators(); 1222 FilePath input = FilePath(cases[i].input).NormalizePathSeparators();
1229 FilePath expected = FilePath(cases[i].expected).NormalizePathSeparators(); 1223 FilePath expected = FilePath(cases[i].expected).NormalizePathSeparators();
1230 EXPECT_EQ(expected.value(), input.AsEndingWithSeparator().value()); 1224 EXPECT_EQ(expected.value(), input.AsEndingWithSeparator().value());
1231 } 1225 }
1232 } 1226 }
1233 1227
1234 } // namespace base 1228 } // namespace base
OLDNEW
« no previous file with comments | « trunk/src/base/files/file_path.cc ('k') | trunk/src/webkit/fileapi/sandbox_mount_point_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698