| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 base::FilePath expected_path = | 1562 base::FilePath expected_path = |
| 1563 GetPathInDownloadDir(test_case.expected_local_path); | 1563 GetPathInDownloadDir(test_case.expected_local_path); |
| 1564 ON_CALL(*item.get(), GetLastReason()) | 1564 ON_CALL(*item.get(), GetLastReason()) |
| 1565 .WillByDefault(Return( | 1565 .WillByDefault(Return( |
| 1566 content::DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED)); | 1566 content::DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED)); |
| 1567 // Extensions should be notified if a new path is being generated and there | 1567 // Extensions should be notified if a new path is being generated and there |
| 1568 // is no forced path. In the test cases above, this is true for tests with | 1568 // is no forced path. In the test cases above, this is true for tests with |
| 1569 // type == AUTOMATIC. | 1569 // type == AUTOMATIC. |
| 1570 EXPECT_CALL(*delegate(), NotifyExtensions(_, _, _)) | 1570 EXPECT_CALL(*delegate(), NotifyExtensions(_, _, _)) |
| 1571 .Times(test_case.test_type == AUTOMATIC ? 1 : 0); | 1571 .Times(test_case.test_type == AUTOMATIC ? 1 : 0); |
| 1572 EXPECT_CALL(*delegate(), ReserveVirtualPath(_, expected_path, false, _, _)); | 1572 // When resuming an AUTOMATIC download with non-empty initial path, the file |
| 1573 // name conflict action should be UNIQUIFY. |
| 1574 DownloadPathReservationTracker::FilenameConflictAction action = |
| 1575 test_case.test_type == AUTOMATIC ? |
| 1576 DownloadPathReservationTracker::UNIQUIFY : |
| 1577 DownloadPathReservationTracker::OVERWRITE; |
| 1578 EXPECT_CALL(*delegate(), ReserveVirtualPath( |
| 1579 _, expected_path, false, action, _)); |
| 1573 EXPECT_CALL(*delegate(), PromptUserForDownloadPath(_, expected_path, _)) | 1580 EXPECT_CALL(*delegate(), PromptUserForDownloadPath(_, expected_path, _)) |
| 1574 .Times(0); | 1581 .Times(0); |
| 1575 EXPECT_CALL(*delegate(), DetermineLocalPath(_, expected_path, _)); | 1582 EXPECT_CALL(*delegate(), DetermineLocalPath(_, expected_path, _)); |
| 1576 EXPECT_CALL(*delegate(), CheckDownloadUrl(_, expected_path, _)); | 1583 EXPECT_CALL(*delegate(), CheckDownloadUrl(_, expected_path, _)); |
| 1577 RunTestCase(test_case, GetPathInDownloadDir(kInitialPath), item.get()); | 1584 RunTestCase(test_case, GetPathInDownloadDir(kInitialPath), item.get()); |
| 1578 } | 1585 } |
| 1579 } | 1586 } |
| 1580 | 1587 |
| 1581 // Test that a forced download doesn't prompt, even if the interrupt reason | 1588 // Test that a forced download doesn't prompt, even if the interrupt reason |
| 1582 // suggests that the target path may not be suitable for downloads. | 1589 // suggests that the target path may not be suitable for downloads. |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2194 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(browser_plugin.path())) | 2201 EXPECT_CALL(mock_plugin_filter_, MockPluginAvailable(browser_plugin.path())) |
| 2195 .WillRepeatedly(Return(false)); | 2202 .WillRepeatedly(Return(false)); |
| 2196 target_info = RunDownloadTargetDeterminer( | 2203 target_info = RunDownloadTargetDeterminer( |
| 2197 GetPathInDownloadDir(kInitialPath), item.get()); | 2204 GetPathInDownloadDir(kInitialPath), item.get()); |
| 2198 EXPECT_FALSE(target_info->is_filetype_handled_safely); | 2205 EXPECT_FALSE(target_info->is_filetype_handled_safely); |
| 2199 } | 2206 } |
| 2200 | 2207 |
| 2201 #endif // BUILDFLAG(ENABLE_PLUGINS) | 2208 #endif // BUILDFLAG(ENABLE_PLUGINS) |
| 2202 | 2209 |
| 2203 } // namespace | 2210 } // namespace |
| OLD | NEW |