| 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 EXPECT_TRUE(IsPathInUse(new_target_path)); | 446 EXPECT_TRUE(IsPathInUse(new_target_path)); |
| 447 | 447 |
| 448 // Destroying the item should release the reservation. | 448 // Destroying the item should release the reservation. |
| 449 item.reset(); | 449 item.reset(); |
| 450 message_loop_.RunUntilIdle(); | 450 message_loop_.RunUntilIdle(); |
| 451 EXPECT_FALSE(IsPathInUse(new_target_path)); | 451 EXPECT_FALSE(IsPathInUse(new_target_path)); |
| 452 } | 452 } |
| 453 | 453 |
| 454 // Tests for long name truncation. On other platforms automatic truncation | 454 // Tests for long name truncation. On other platforms automatic truncation |
| 455 // is not performed (yet). | 455 // is not performed (yet). |
| 456 #if defined(OS_WIN) || defined(OS_MAC) || defined(OS_CHROMEOS) | 456 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) |
| 457 | 457 |
| 458 TEST_F(DownloadPathReservationTrackerTest, BasicTruncation) { | 458 TEST_F(DownloadPathReservationTrackerTest, BasicTruncation) { |
| 459 int real_max_length = | 459 int real_max_length = |
| 460 file_util::GetMaximumPathComponentLength(default_download_path()); | 460 file_util::GetMaximumPathComponentLength(default_download_path()); |
| 461 ASSERT_NE(-1, real_max_length); | 461 ASSERT_NE(-1, real_max_length); |
| 462 | 462 |
| 463 // TODO(kinaba): the current implementation leaves spaces for appending | 463 // TODO(kinaba): the current implementation leaves spaces for appending |
| 464 // ".crdownload". So take it into account. Should be removed in the future. | 464 // ".crdownload". So take it into account. Should be removed in the future. |
| 465 const size_t max_length = real_max_length - 11; | 465 const size_t max_length = real_max_length - 11; |
| 466 | 466 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 ASSERT_FALSE(IsPathInUse(path)); | 523 ASSERT_FALSE(IsPathInUse(path)); |
| 524 | 524 |
| 525 base::FilePath reserved_path; | 525 base::FilePath reserved_path; |
| 526 bool verified = false; | 526 bool verified = false; |
| 527 CallGetReservedPath(*item, path, false, &reserved_path, &verified); | 527 CallGetReservedPath(*item, path, false, &reserved_path, &verified); |
| 528 // We cannot truncate a path with very long extension. | 528 // We cannot truncate a path with very long extension. |
| 529 EXPECT_FALSE(verified); | 529 EXPECT_FALSE(verified); |
| 530 } | 530 } |
| 531 | 531 |
| 532 #endif | 532 #endif |
| OLD | NEW |