OLD | NEW |
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 "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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 // Delete the reparse points, and see that NormalizeFilePath() fails | 419 // Delete the reparse points, and see that NormalizeFilePath() fails |
420 // to traverse them. | 420 // to traverse them. |
421 } | 421 } |
422 | 422 |
423 ASSERT_FALSE(NormalizeFilePath(to_sub_a.Append(FPL("file.txt")), | 423 ASSERT_FALSE(NormalizeFilePath(to_sub_a.Append(FPL("file.txt")), |
424 &normalized_path)); | 424 &normalized_path)); |
425 } | 425 } |
426 | 426 |
427 TEST_F(FileUtilTest, DevicePathToDriveLetter) { | 427 TEST_F(FileUtilTest, DevicePathToDriveLetter) { |
428 // Get a drive letter. | 428 // Get a drive letter. |
429 std::wstring real_drive_letter = temp_dir_.path().value().substr(0, 2); | 429 string16 real_drive_letter = |
430 StringToUpperASCII(&real_drive_letter); | 430 ToUpperASCII(temp_dir_.path().value().substr(0, 2)); |
431 if (!isalpha(real_drive_letter[0]) || ':' != real_drive_letter[1]) { | 431 if (!isalpha(real_drive_letter[0]) || ':' != real_drive_letter[1]) { |
432 LOG(ERROR) << "Can't get a drive letter to test with."; | 432 LOG(ERROR) << "Can't get a drive letter to test with."; |
433 return; | 433 return; |
434 } | 434 } |
435 | 435 |
436 // Get the NT style path to that drive. | 436 // Get the NT style path to that drive. |
437 wchar_t device_path[MAX_PATH] = {'\0'}; | 437 wchar_t device_path[MAX_PATH] = {'\0'}; |
438 ASSERT_TRUE( | 438 ASSERT_TRUE( |
439 ::QueryDosDevice(real_drive_letter.c_str(), device_path, MAX_PATH)); | 439 ::QueryDosDevice(real_drive_letter.c_str(), device_path, MAX_PATH)); |
440 FilePath actual_device_path(device_path); | 440 FilePath actual_device_path(device_path); |
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2518 // Trying to close it should crash. This is important for security. | 2518 // Trying to close it should crash. This is important for security. |
2519 EXPECT_DEATH(CloseWithScopedFD(fds[1]), ""); | 2519 EXPECT_DEATH(CloseWithScopedFD(fds[1]), ""); |
2520 #endif | 2520 #endif |
2521 } | 2521 } |
2522 | 2522 |
2523 #endif // defined(OS_POSIX) | 2523 #endif // defined(OS_POSIX) |
2524 | 2524 |
2525 } // namespace | 2525 } // namespace |
2526 | 2526 |
2527 } // namespace base | 2527 } // namespace base |
OLD | NEW |