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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 for (size_t j = 0; j < comps.size(); ++j) { | 1008 for (size_t j = 0; j < comps.size(); ++j) { |
1009 result.append(comps[j]); | 1009 result.append(comps[j]); |
1010 if (j < comps.size() - 1) | 1010 if (j < comps.size() - 1) |
1011 result.append(FILE_PATH_LITERAL("|"), 1); | 1011 result.append(FILE_PATH_LITERAL("|"), 1); |
1012 } | 1012 } |
1013 EXPECT_EQ(kPathComponents[i].result, result); | 1013 EXPECT_EQ(kPathComponents[i].result, result); |
1014 } | 1014 } |
1015 } | 1015 } |
1016 | 1016 |
1017 TEST_F(FileUtilTest, Contains) { | 1017 TEST_F(FileUtilTest, Contains) { |
1018 FilePath data_dir; | 1018 FilePath data_dir = test_dir_.Append(FILE_PATH_LITERAL("FilePathTest")); |
1019 ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &data_dir)); | |
1020 data_dir = data_dir.Append(FILE_PATH_LITERAL("FilePathTest")); | |
1021 | 1019 |
1022 // Create a fresh, empty copy of this directory. | 1020 // Create a fresh, empty copy of this directory. |
1023 if (file_util::PathExists(data_dir)) { | 1021 if (file_util::PathExists(data_dir)) { |
1024 ASSERT_TRUE(file_util::Delete(data_dir, true)); | 1022 ASSERT_TRUE(file_util::Delete(data_dir, true)); |
1025 } | 1023 } |
1026 ASSERT_TRUE(file_util::CreateDirectory(data_dir)); | 1024 ASSERT_TRUE(file_util::CreateDirectory(data_dir)); |
1027 | 1025 |
1028 FilePath foo(data_dir.Append(FILE_PATH_LITERAL("foo"))); | 1026 FilePath foo(data_dir.Append(FILE_PATH_LITERAL("foo"))); |
1029 FilePath bar(foo.Append(FILE_PATH_LITERAL("bar.txt"))); | 1027 FilePath bar(foo.Append(FILE_PATH_LITERAL("bar.txt"))); |
1030 FilePath baz(data_dir.Append(FILE_PATH_LITERAL("baz.txt"))); | 1028 FilePath baz(data_dir.Append(FILE_PATH_LITERAL("baz.txt"))); |
(...skipping 25 matching lines...) Expand all Loading... |
1056 #elif defined(OS_LINUX) | 1054 #elif defined(OS_LINUX) |
1057 EXPECT_FALSE(file_util::ContainsPath(foo, | 1055 EXPECT_FALSE(file_util::ContainsPath(foo, |
1058 foo_caps.Append(FILE_PATH_LITERAL("bar.txt")))); | 1056 foo_caps.Append(FILE_PATH_LITERAL("bar.txt")))); |
1059 #else | 1057 #else |
1060 // We can't really do this test on osx since the case-sensitivity of the | 1058 // We can't really do this test on osx since the case-sensitivity of the |
1061 // filesystem is configurable. | 1059 // filesystem is configurable. |
1062 #endif | 1060 #endif |
1063 } | 1061 } |
1064 | 1062 |
1065 } // namespace | 1063 } // namespace |
OLD | NEW |