OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 while (top_level != top_level.DirName()) { | 1149 while (top_level != top_level.DirName()) { |
1150 top_level = top_level.DirName(); | 1150 top_level = top_level.DirName(); |
1151 } | 1151 } |
1152 ASSERT_TRUE(file_util::DirectoryExists(top_level)); | 1152 ASSERT_TRUE(file_util::DirectoryExists(top_level)); |
1153 | 1153 |
1154 // Given these assumptions hold, it should be safe to | 1154 // Given these assumptions hold, it should be safe to |
1155 // test that "creating" these directories succeeds. | 1155 // test that "creating" these directories succeeds. |
1156 EXPECT_TRUE(file_util::CreateDirectory( | 1156 EXPECT_TRUE(file_util::CreateDirectory( |
1157 FilePath(FilePath::kCurrentDirectory))); | 1157 FilePath(FilePath::kCurrentDirectory))); |
1158 EXPECT_TRUE(file_util::CreateDirectory(top_level)); | 1158 EXPECT_TRUE(file_util::CreateDirectory(top_level)); |
| 1159 |
| 1160 #if defined(OS_WIN) |
| 1161 FilePath invalid_drive(FILE_PATH_LITERAL("o:\\")); |
| 1162 FilePath invalid_path = |
| 1163 invalid_drive.Append(FILE_PATH_LITERAL("some\\inaccessible\\dir")); |
| 1164 if (!file_util::PathExists(invalid_drive)) { |
| 1165 EXPECT_FALSE(file_util::CreateDirectory(invalid_path)); |
| 1166 } |
| 1167 #endif |
1159 } | 1168 } |
1160 | 1169 |
1161 TEST_F(FileUtilTest, DetectDirectoryTest) { | 1170 TEST_F(FileUtilTest, DetectDirectoryTest) { |
1162 // Check a directory | 1171 // Check a directory |
1163 FilePath test_root = | 1172 FilePath test_root = |
1164 test_dir_.Append(FILE_PATH_LITERAL("detect_directory_test")); | 1173 test_dir_.Append(FILE_PATH_LITERAL("detect_directory_test")); |
1165 EXPECT_FALSE(file_util::PathExists(test_root)); | 1174 EXPECT_FALSE(file_util::PathExists(test_root)); |
1166 EXPECT_TRUE(file_util::CreateDirectory(test_root)); | 1175 EXPECT_TRUE(file_util::CreateDirectory(test_root)); |
1167 EXPECT_TRUE(file_util::PathExists(test_root)); | 1176 EXPECT_TRUE(file_util::PathExists(test_root)); |
1168 EXPECT_TRUE(file_util::DirectoryExists(test_root)); | 1177 EXPECT_TRUE(file_util::DirectoryExists(test_root)); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 #elif defined(OS_LINUX) | 1383 #elif defined(OS_LINUX) |
1375 EXPECT_FALSE(file_util::ContainsPath(foo, | 1384 EXPECT_FALSE(file_util::ContainsPath(foo, |
1376 foo_caps.Append(FILE_PATH_LITERAL("bar.txt")))); | 1385 foo_caps.Append(FILE_PATH_LITERAL("bar.txt")))); |
1377 #else | 1386 #else |
1378 // We can't really do this test on osx since the case-sensitivity of the | 1387 // We can't really do this test on osx since the case-sensitivity of the |
1379 // filesystem is configurable. | 1388 // filesystem is configurable. |
1380 #endif | 1389 #endif |
1381 } | 1390 } |
1382 | 1391 |
1383 } // namespace | 1392 } // namespace |
OLD | NEW |