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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 // Without making the path a bit shorter, CreateDirectory() fails. | 346 // Without making the path a bit shorter, CreateDirectory() fails. |
347 // the resulting path is still long enough to hit the failing case in | 347 // the resulting path is still long enough to hit the failing case in |
348 // NormalizePath(). | 348 // NormalizePath(). |
349 const int kCreateDirLimit = 4; | 349 const int kCreateDirLimit = 4; |
350 target_length -= kCreateDirLimit; | 350 target_length -= kCreateDirLimit; |
351 FilePath::StringType long_name_str = FPL("long_name_"); | 351 FilePath::StringType long_name_str = FPL("long_name_"); |
352 long_name_str.resize(target_length, '_'); | 352 long_name_str.resize(target_length, '_'); |
353 | 353 |
354 FilePath long_name = sub_a.Append(FilePath(long_name_str)); | 354 FilePath long_name = sub_a.Append(FilePath(long_name_str)); |
355 FilePath deep_file = long_name.Append(sub_long_rel).Append(deep_txt); | 355 FilePath deep_file = long_name.Append(sub_long_rel).Append(deep_txt); |
356 ASSERT_EQ(MAX_PATH - kCreateDirLimit, deep_file.value().length()); | 356 ASSERT_EQ(static_cast<size_t>(MAX_PATH - kCreateDirLimit), |
| 357 deep_file.value().length()); |
357 | 358 |
358 FilePath sub_long = deep_file.DirName(); | 359 FilePath sub_long = deep_file.DirName(); |
359 ASSERT_TRUE(CreateDirectory(sub_long)); | 360 ASSERT_TRUE(CreateDirectory(sub_long)); |
360 CreateTextFile(deep_file, bogus_content); | 361 CreateTextFile(deep_file, bogus_content); |
361 | 362 |
362 FilePath base_b = temp_dir_.path().Append(FPL("base_b")); | 363 FilePath base_b = temp_dir_.path().Append(FPL("base_b")); |
363 ASSERT_TRUE(CreateDirectory(base_b)); | 364 ASSERT_TRUE(CreateDirectory(base_b)); |
364 | 365 |
365 FilePath to_sub_a = base_b.Append(FPL("to_sub_a")); | 366 FilePath to_sub_a = base_b.Append(FPL("to_sub_a")); |
366 ASSERT_TRUE(CreateDirectory(to_sub_a)); | 367 ASSERT_TRUE(CreateDirectory(to_sub_a)); |
(...skipping 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2518 // Trying to close it should crash. This is important for security. | 2519 // Trying to close it should crash. This is important for security. |
2519 EXPECT_DEATH(CloseWithScopedFD(fds[1]), ""); | 2520 EXPECT_DEATH(CloseWithScopedFD(fds[1]), ""); |
2520 #endif | 2521 #endif |
2521 } | 2522 } |
2522 | 2523 |
2523 #endif // defined(OS_POSIX) | 2524 #endif // defined(OS_POSIX) |
2524 | 2525 |
2525 } // namespace | 2526 } // namespace |
2526 | 2527 |
2527 } // namespace base | 2528 } // namespace base |
OLD | NEW |