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

Side by Side Diff: base/file_path_unittest.cc

Issue 209070: Fix and reenable AppendRelativePathTest which was broken on Windows.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/platform_test.h" 10 #include "testing/platform_test.h"
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 for (size_t i = 0; i < arraysize(cases); ++i) { 478 for (size_t i = 0; i < arraysize(cases); ++i) {
479 FilePath parent(cases[i].inputs[0]); 479 FilePath parent(cases[i].inputs[0]);
480 FilePath child(cases[i].inputs[1]); 480 FilePath child(cases[i].inputs[1]);
481 481
482 EXPECT_EQ(parent.IsParent(child), cases[i].expected) << 482 EXPECT_EQ(parent.IsParent(child), cases[i].expected) <<
483 "i: " << i << ", parent: " << parent.value() << ", child: " << 483 "i: " << i << ", parent: " << parent.value() << ", child: " <<
484 child.value(); 484 child.value();
485 } 485 }
486 } 486 }
487 487
488 TEST_F(FilePathTest, DISABLED_AppendRelativePathTest) { 488 TEST_F(FilePathTest, AppendRelativePathTest) {
489 const struct BinaryTestData cases[] = { 489 const struct BinaryTestData cases[] = {
490 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
491 { { FPL("/"), FPL("/foo/bar/baz") }, FPL("foo\\bar\\baz")},
492 #else // FILE_PATH_USES_WIN_SEPARATORS
490 { { FPL("/"), FPL("/foo/bar/baz") }, FPL("foo/bar/baz")}, 493 { { FPL("/"), FPL("/foo/bar/baz") }, FPL("foo/bar/baz")},
494 #endif // FILE_PATH_USES_WIN_SEPARATORS
491 { { FPL("/foo/bar"), FPL("/foo/bar/baz") }, FPL("baz")}, 495 { { FPL("/foo/bar"), FPL("/foo/bar/baz") }, FPL("baz")},
492 { { FPL("/foo/bar/"), FPL("/foo/bar/baz") }, FPL("baz")}, 496 { { FPL("/foo/bar/"), FPL("/foo/bar/baz") }, FPL("baz")},
493 { { FPL("//foo/bar/"), FPL("//foo/bar/baz") }, FPL("baz")}, 497 { { FPL("//foo/bar/"), FPL("//foo/bar/baz") }, FPL("baz")},
494 { { FPL("/foo/bar"), FPL("/foo2/bar/baz") }, FPL("")}, 498 { { FPL("/foo/bar"), FPL("/foo2/bar/baz") }, FPL("")},
495 { { FPL("/foo/bar.txt"), FPL("/foo/bar/baz") }, FPL("")}, 499 { { FPL("/foo/bar.txt"), FPL("/foo/bar/baz") }, FPL("")},
496 { { FPL("/foo/bar"), FPL("/foo/bar2/baz") }, FPL("")}, 500 { { FPL("/foo/bar"), FPL("/foo/bar2/baz") }, FPL("")},
497 { { FPL("/foo/bar"), FPL("/foo/bar") }, FPL("")}, 501 { { FPL("/foo/bar"), FPL("/foo/bar") }, FPL("")},
498 { { FPL("/foo/bar/baz"), FPL("/foo/bar") }, FPL("")}, 502 { { FPL("/foo/bar/baz"), FPL("/foo/bar") }, FPL("")},
499 { { FPL("foo/bar"), FPL("foo/bar/baz") }, FPL("baz")}, 503 { { FPL("foo/bar"), FPL("foo/bar/baz") }, FPL("baz")},
500 { { FPL("foo/bar"), FPL("foo2/bar/baz") }, FPL("")}, 504 { { FPL("foo/bar"), FPL("foo2/bar/baz") }, FPL("")},
501 { { FPL("foo/bar"), FPL("foo/bar2/baz") }, FPL("")}, 505 { { FPL("foo/bar"), FPL("foo/bar2/baz") }, FPL("")},
502 { { FPL(""), FPL("foo") }, FPL("")}, 506 { { FPL(""), FPL("foo") }, FPL("")},
503 #if defined(FILE_PATH_USES_DRIVE_LETTERS) 507 #if defined(FILE_PATH_USES_DRIVE_LETTERS)
504 { { FPL("c:/foo/bar"), FPL("c:/foo/bar/baz") }, FPL("baz")}, 508 { { FPL("c:/foo/bar"), FPL("c:/foo/bar/baz") }, FPL("baz")},
505 { { FPL("E:/foo/bar"), FPL("e:/foo/bar/baz") }, FPL("baz")}, 509 { { FPL("E:/foo/bar"), FPL("e:/foo/bar/baz") }, FPL("baz")},
506 { { FPL("f:/foo/bar"), FPL("F:/foo/bar/baz") }, FPL("baz")}, 510 { { FPL("f:/foo/bar"), FPL("F:/foo/bar/baz") }, FPL("baz")},
507 { { FPL("E:/Foo/bar"), FPL("e:/foo/bar/baz") }, FPL("")}, 511 { { FPL("E:/Foo/bar"), FPL("e:/foo/bar/baz") }, FPL("")},
508 { { FPL("f:/foo/bar"), FPL("F:/foo/Bar/baz") }, FPL("")}, 512 { { FPL("f:/foo/bar"), FPL("F:/foo/Bar/baz") }, FPL("")},
509 { { FPL("c:/"), FPL("c:/foo/bar/baz") }, FPL("foo/bar/baz")}, 513 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
510 { { FPL("c:"), FPL("c:/foo/bar/baz") }, FPL("foo/bar/baz")}, 514 { { FPL("c:/"), FPL("c:/foo/bar/baz") }, FPL("foo\\bar\\baz")},
515 // TODO(akalin): Figure out how to handle the corner case in the
516 // commented-out test case below. Appending to an empty path gives
517 // /foo\bar\baz but appending to a nonempty path "blah" gives
518 // blah\foo\bar\baz.
519 // { { FPL("c:"), FPL("c:/foo/bar/baz") }, FPL("foo\\bar\\baz")},
520 #endif // FILE_PATH_USES_WIN_SEPARATORS
511 { { FPL("c:/foo/bar"), FPL("d:/foo/bar/baz") }, FPL("")}, 521 { { FPL("c:/foo/bar"), FPL("d:/foo/bar/baz") }, FPL("")},
512 { { FPL("c:/foo/bar"), FPL("D:/foo/bar/baz") }, FPL("")}, 522 { { FPL("c:/foo/bar"), FPL("D:/foo/bar/baz") }, FPL("")},
513 { { FPL("C:/foo/bar"), FPL("d:/foo/bar/baz") }, FPL("")}, 523 { { FPL("C:/foo/bar"), FPL("d:/foo/bar/baz") }, FPL("")},
514 { { FPL("c:/foo/bar"), FPL("c:/foo2/bar/baz") }, FPL("")}, 524 { { FPL("c:/foo/bar"), FPL("c:/foo2/bar/baz") }, FPL("")},
515 { { FPL("e:/foo/bar"), FPL("E:/foo2/bar/baz") }, FPL("")}, 525 { { FPL("e:/foo/bar"), FPL("E:/foo2/bar/baz") }, FPL("")},
516 { { FPL("F:/foo/bar"), FPL("f:/foo2/bar/baz") }, FPL("")}, 526 { { FPL("F:/foo/bar"), FPL("f:/foo2/bar/baz") }, FPL("")},
517 { { FPL("c:/foo/bar"), FPL("c:/foo/bar2/baz") }, FPL("")}, 527 { { FPL("c:/foo/bar"), FPL("c:/foo/bar2/baz") }, FPL("")},
518 #endif // FILE_PATH_USES_DRIVE_LETTERS 528 #endif // FILE_PATH_USES_DRIVE_LETTERS
519 #if defined(FILE_PATH_USES_WIN_SEPARATORS) 529 #if defined(FILE_PATH_USES_WIN_SEPARATORS)
520 { { FPL("\\foo\\bar"), FPL("\\foo\\bar\\baz") }, FPL("baz")}, 530 { { FPL("\\foo\\bar"), FPL("\\foo\\bar\\baz") }, FPL("baz")},
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 }; 838 };
829 839
830 for (size_t i = 0; i < arraysize(cases); ++i) { 840 for (size_t i = 0; i < arraysize(cases); ++i) {
831 FilePath input(cases[i].input); 841 FilePath input(cases[i].input);
832 bool observed = input.ReferencesParent(); 842 bool observed = input.ReferencesParent();
833 EXPECT_EQ(cases[i].expected, observed) << 843 EXPECT_EQ(cases[i].expected, observed) <<
834 "i: " << i << ", input: " << input.value(); 844 "i: " << i << ", input: " << input.value();
835 } 845 }
836 } 846 }
837 847
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698