1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/profiles/file_path_verifier_win.h"
7 #include "base/files/file_path.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 TEST(FilePathVerifierTest
, ComparePathsIgnoreCase
) {
11 const struct PathComparisonReasonTestData
{
12 const base::FilePath::CharType
* inputs
[2];
13 internal::PathComparisonReason expected
;
15 { { FILE_PATH_LITERAL("test/foo.bar"),
16 FILE_PATH_LITERAL("test/foo.bar") },
17 internal::PATH_COMPARISON_EQUAL
},
18 { { FILE_PATH_LITERAL("test\\foo.bar"),
19 FILE_PATH_LITERAL("test\\foo.bar") },
20 internal::PATH_COMPARISON_EQUAL
},
21 { { FILE_PATH_LITERAL("test/foo.bar"),
22 FILE_PATH_LITERAL("test/foo.baz") },
23 internal::PATH_COMPARISON_FAILED_SAMEDIR
},
24 { { FILE_PATH_LITERAL("test/foo.bar"),
25 FILE_PATH_LITERAL("test/joe/foo.bar") },
26 internal::PATH_COMPARISON_FAILED_SAMEBASE
},
27 { { FILE_PATH_LITERAL("test/foo.bar"),
28 FILE_PATH_LITERAL("jack/bar.buz") },
29 internal::PATH_COMPARISON_FAILED_UNKNOWN
},
32 for (size_t i
= 0; i
< arraysize(cases
); ++i
) {
33 base::FilePath
p1(cases
[i
].inputs
[0]);
34 base::FilePath
p2(cases
[i
].inputs
[1]);
35 internal::PathComparisonReason reason
=
36 internal::ComparePathsIgnoreCase(p1
, p2
);
37 EXPECT_EQ(cases
[i
].expected
, reason
) <<
38 "i: " << i
<< ", p1: " << p1
.value() << ", p2: " << p2
.value();