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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 const wchar_t bogus_content[] = L"I'm cannon fodder."; | 178 const wchar_t bogus_content[] = L"I'm cannon fodder."; |
179 | 179 |
180 const int FILES_AND_DIRECTORIES = | 180 const int FILES_AND_DIRECTORIES = |
181 FileEnumerator::FILES | FileEnumerator::DIRECTORIES; | 181 FileEnumerator::FILES | FileEnumerator::DIRECTORIES; |
182 | 182 |
183 // file_util winds up using autoreleased objects on the Mac, so this needs | 183 // file_util winds up using autoreleased objects on the Mac, so this needs |
184 // to be a PlatformTest | 184 // to be a PlatformTest |
185 class FileUtilTest : public PlatformTest { | 185 class FileUtilTest : public PlatformTest { |
186 protected: | 186 protected: |
187 virtual void SetUp() OVERRIDE { | 187 void SetUp() override { |
188 PlatformTest::SetUp(); | 188 PlatformTest::SetUp(); |
189 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 189 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
190 } | 190 } |
191 | 191 |
192 ScopedTempDir temp_dir_; | 192 ScopedTempDir temp_dir_; |
193 }; | 193 }; |
194 | 194 |
195 // Collects all the results from the given file enumerator, and provides an | 195 // Collects all the results from the given file enumerator, and provides an |
196 // interface to query whether a given file is present. | 196 // interface to query whether a given file is present. |
197 class FindResultCollector { | 197 class FindResultCollector { |
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2144 // Testing VerifyPathControlledByAdmin() is hard, because there is no | 2144 // Testing VerifyPathControlledByAdmin() is hard, because there is no |
2145 // way a test can make a file owned by root, or change file paths | 2145 // way a test can make a file owned by root, or change file paths |
2146 // at the root of the file system. VerifyPathControlledByAdmin() | 2146 // at the root of the file system. VerifyPathControlledByAdmin() |
2147 // is implemented as a call to VerifyPathControlledByUser, which gives | 2147 // is implemented as a call to VerifyPathControlledByUser, which gives |
2148 // us the ability to test with paths under the test's temp directory, | 2148 // us the ability to test with paths under the test's temp directory, |
2149 // using a user id we control. | 2149 // using a user id we control. |
2150 // Pull tests of VerifyPathControlledByUserTest() into a separate test class | 2150 // Pull tests of VerifyPathControlledByUserTest() into a separate test class |
2151 // with a common SetUp() method. | 2151 // with a common SetUp() method. |
2152 class VerifyPathControlledByUserTest : public FileUtilTest { | 2152 class VerifyPathControlledByUserTest : public FileUtilTest { |
2153 protected: | 2153 protected: |
2154 virtual void SetUp() OVERRIDE { | 2154 void SetUp() override { |
2155 FileUtilTest::SetUp(); | 2155 FileUtilTest::SetUp(); |
2156 | 2156 |
2157 // Create a basic structure used by each test. | 2157 // Create a basic structure used by each test. |
2158 // base_dir_ | 2158 // base_dir_ |
2159 // |-> sub_dir_ | 2159 // |-> sub_dir_ |
2160 // |-> text_file_ | 2160 // |-> text_file_ |
2161 | 2161 |
2162 base_dir_ = temp_dir_.path().AppendASCII("base_dir"); | 2162 base_dir_ = temp_dir_.path().AppendASCII("base_dir"); |
2163 ASSERT_TRUE(CreateDirectory(base_dir_)); | 2163 ASSERT_TRUE(CreateDirectory(base_dir_)); |
2164 | 2164 |
(...skipping 422 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 |