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> |
11 #include <tchar.h> | 11 #include <tchar.h> |
12 #include <winioctl.h> | 12 #include <winioctl.h> |
13 #endif | 13 #endif |
14 | 14 |
15 #if defined(OS_POSIX) | 15 #if defined(OS_POSIX) |
16 #include <errno.h> | 16 #include <errno.h> |
17 #include <fcntl.h> | 17 #include <fcntl.h> |
18 #include <unistd.h> | 18 #include <unistd.h> |
19 #endif | 19 #endif |
20 | 20 |
21 #include <algorithm> | 21 #include <algorithm> |
22 #include <fstream> | 22 #include <fstream> |
23 #include <set> | 23 #include <set> |
24 #include <vector> | 24 #include <vector> |
25 | 25 |
26 #include "base/base_paths.h" | 26 #include "base/base_paths.h" |
27 #include "base/file_util.h" | |
28 #include "base/files/file_enumerator.h" | 27 #include "base/files/file_enumerator.h" |
29 #include "base/files/file_path.h" | 28 #include "base/files/file_path.h" |
| 29 #include "base/files/file_util.h" |
30 #include "base/files/scoped_file.h" | 30 #include "base/files/scoped_file.h" |
31 #include "base/files/scoped_temp_dir.h" | 31 #include "base/files/scoped_temp_dir.h" |
32 #include "base/path_service.h" | 32 #include "base/path_service.h" |
33 #include "base/strings/utf_string_conversions.h" | 33 #include "base/strings/utf_string_conversions.h" |
34 #include "base/test/test_file_util.h" | 34 #include "base/test/test_file_util.h" |
35 #include "base/threading/platform_thread.h" | 35 #include "base/threading/platform_thread.h" |
36 #include "testing/gtest/include/gtest/gtest.h" | 36 #include "testing/gtest/include/gtest/gtest.h" |
37 #include "testing/platform_test.h" | 37 #include "testing/platform_test.h" |
38 | 38 |
39 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
40 #include "base/win/scoped_handle.h" | 40 #include "base/win/scoped_handle.h" |
41 #include "base/win/windows_version.h" | 41 #include "base/win/windows_version.h" |
42 #endif | 42 #endif |
43 | 43 |
44 #if defined(OS_ANDROID) | 44 #if defined(OS_ANDROID) |
45 #include "base/android/content_uri_utils.h" | 45 #include "base/android/content_uri_utils.h" |
46 #endif | 46 #endif |
47 | 47 |
48 // This macro helps avoid wrapped lines in the test structs. | 48 // This macro helps avoid wrapped lines in the test structs. |
49 #define FPL(x) FILE_PATH_LITERAL(x) | 49 #define FPL(x) FILE_PATH_LITERAL(x) |
50 | 50 |
51 namespace base { | 51 namespace base { |
52 | 52 |
53 namespace { | 53 namespace { |
54 | 54 |
55 // To test that file_util::Normalize FilePath() deals with NTFS reparse points | 55 // To test that NormalizeFilePath() deals with NTFS reparse points correctly, |
56 // correctly, we need functions to create and delete reparse points. | 56 // we need functions to create and delete reparse points. |
57 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
58 typedef struct _REPARSE_DATA_BUFFER { | 58 typedef struct _REPARSE_DATA_BUFFER { |
59 ULONG ReparseTag; | 59 ULONG ReparseTag; |
60 USHORT ReparseDataLength; | 60 USHORT ReparseDataLength; |
61 USHORT Reserved; | 61 USHORT Reserved; |
62 union { | 62 union { |
63 struct { | 63 struct { |
64 USHORT SubstituteNameOffset; | 64 USHORT SubstituteNameOffset; |
65 USHORT SubstituteNameLength; | 65 USHORT SubstituteNameLength; |
66 USHORT PrintNameOffset; | 66 USHORT PrintNameOffset; |
(...skipping 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2587 // Trying to close it should crash. This is important for security. | 2587 // Trying to close it should crash. This is important for security. |
2588 EXPECT_DEATH(CloseWithScopedFD(fds[1]), ""); | 2588 EXPECT_DEATH(CloseWithScopedFD(fds[1]), ""); |
2589 #endif | 2589 #endif |
2590 } | 2590 } |
2591 | 2591 |
2592 #endif // defined(OS_POSIX) | 2592 #endif // defined(OS_POSIX) |
2593 | 2593 |
2594 } // namespace | 2594 } // namespace |
2595 | 2595 |
2596 } // namespace base | 2596 } // namespace base |
OLD | NEW |