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 #include <algorithm> | 15 #include <algorithm> |
16 #include <fstream> | 16 #include <fstream> |
17 #include <set> | 17 #include <set> |
18 | 18 |
19 #include "base/base_paths.h" | 19 #include "base/base_paths.h" |
20 #include "base/file_path.h" | 20 #include "base/file_path.h" |
21 #include "base/file_util.h" | 21 #include "base/file_util.h" |
| 22 #include "base/files/scoped_temp_dir.h" |
22 #include "base/path_service.h" | 23 #include "base/path_service.h" |
23 #include "base/scoped_temp_dir.h" | |
24 #include "base/test/test_file_util.h" | 24 #include "base/test/test_file_util.h" |
25 #include "base/threading/platform_thread.h" | 25 #include "base/threading/platform_thread.h" |
26 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
28 #include "testing/platform_test.h" | 28 #include "testing/platform_test.h" |
29 | 29 |
30 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
31 #include "base/win/scoped_handle.h" | 31 #include "base/win/scoped_handle.h" |
32 #endif | 32 #endif |
33 | 33 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 // file_util winds up using autoreleased objects on the Mac, so this needs | 137 // file_util winds up using autoreleased objects on the Mac, so this needs |
138 // to be a PlatformTest | 138 // to be a PlatformTest |
139 class FileUtilTest : public PlatformTest { | 139 class FileUtilTest : public PlatformTest { |
140 protected: | 140 protected: |
141 virtual void SetUp() OVERRIDE { | 141 virtual void SetUp() OVERRIDE { |
142 PlatformTest::SetUp(); | 142 PlatformTest::SetUp(); |
143 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 143 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
144 } | 144 } |
145 | 145 |
146 ScopedTempDir temp_dir_; | 146 base::ScopedTempDir temp_dir_; |
147 }; | 147 }; |
148 | 148 |
149 // Collects all the results from the given file enumerator, and provides an | 149 // Collects all the results from the given file enumerator, and provides an |
150 // interface to query whether a given file is present. | 150 // interface to query whether a given file is present. |
151 class FindResultCollector { | 151 class FindResultCollector { |
152 public: | 152 public: |
153 explicit FindResultCollector(file_util::FileEnumerator& enumerator) { | 153 explicit FindResultCollector(file_util::FileEnumerator& enumerator) { |
154 FilePath cur_file; | 154 FilePath cur_file; |
155 while (!(cur_file = enumerator.Next()).value().empty()) { | 155 while (!(cur_file = enumerator.Next()).value().empty()) { |
156 FilePath::StringType path = cur_file.value(); | 156 FilePath::StringType path = cur_file.value(); |
(...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2440 file_util::VerifyPathControlledByUser( | 2440 file_util::VerifyPathControlledByUser( |
2441 base_dir_, text_file_, uid_, ok_gids_)); | 2441 base_dir_, text_file_, uid_, ok_gids_)); |
2442 EXPECT_TRUE( | 2442 EXPECT_TRUE( |
2443 file_util::VerifyPathControlledByUser( | 2443 file_util::VerifyPathControlledByUser( |
2444 sub_dir_, text_file_, uid_, ok_gids_)); | 2444 sub_dir_, text_file_, uid_, ok_gids_)); |
2445 } | 2445 } |
2446 | 2446 |
2447 #endif // defined(OS_POSIX) | 2447 #endif // defined(OS_POSIX) |
2448 | 2448 |
2449 } // namespace | 2449 } // namespace |
OLD | NEW |