Chromium Code Reviews| Index: chrome/browser/download/download_manager_unittest.cc |
| diff --git a/chrome/browser/download/download_manager_unittest.cc b/chrome/browser/download/download_manager_unittest.cc |
| index fe1376cbcbedb7dfb7b78b7fa609b097cab2a6d8..cc896a1b6c650c1334516f1b374540b065d68f23 100644 |
| --- a/chrome/browser/download/download_manager_unittest.cc |
| +++ b/chrome/browser/download/download_manager_unittest.cc |
| @@ -313,23 +313,14 @@ TEST_F(DownloadManagerTest, StartDownload) { |
| AddDownloadToFileManager(info->download_id, download_file); |
| download_file->Initialize(false); |
| download_manager_->StartDownload(info->download_id); |
| + delete info; |
|
Paweł Hajdan Jr.
2011/05/24 10:08:05
Could you use a scoped_ptr instead? Manually manag
ahendrickson
2011/05/24 15:34:34
Done.
|
| message_loop_.RunAllPending(); |
| - // NOTE: At this point, |ContinueDownloadWithPath| will have been run if |
| - // we don't need to prompt the user, so |info| could have been destructed. |
| - // This means that we can't check any of its values. |
| - // However, SelectFileObserver will have recorded any attempt to open the |
| + // SelectFileObserver will have recorded any attempt to open the |
| // select file dialog. |
| + // Note that DownloadManager::FileSelectionCanceled() is never called. |
| EXPECT_EQ(kStartDownloadCases[i].expected_save_as, |
| observer.ShowedFileDialogForId(i)); |
| - |
| - // If the Save As dialog pops up, it never reached |
| - // DownloadManager::ContinueDownloadWithPath(), and never deleted info or |
| - // completed. This cleans up info. |
| - // Note that DownloadManager::FileSelectionCanceled() is never called. |
| - if (observer.ShowedFileDialogForId(i)) { |
| - delete info; |
| - } |
| } |
| } |
| @@ -371,6 +362,7 @@ TEST_F(DownloadManagerTest, DownloadRenameTest) { |
| 2, new_path)))); |
| } |
| download_manager_->CreateDownloadItem(info); |
| + delete info; |
|
Paweł Hajdan Jr.
2011/05/24 10:08:05
Same here, please use scoped_ptr (in fact, applies
ahendrickson
2011/05/24 15:34:34
Done.
|
| int32* id_ptr = new int32; |
| *id_ptr = i; // Deleted in FileSelected(). |
| @@ -418,6 +410,7 @@ TEST_F(DownloadManagerTest, DownloadInterruptTest) { |
| EXPECT_CALL(*download_file, Rename(cr_path)).WillOnce(Return(true)); |
| download_manager_->CreateDownloadItem(info); |
| + delete info; |
| DownloadItem* download = GetActiveDownloadItem(0); |
| ASSERT_TRUE(download != NULL); |
| @@ -483,6 +476,7 @@ TEST_F(DownloadManagerTest, DownloadCancelTest) { |
| EXPECT_CALL(*download_file, Rename(cr_path)).WillOnce(Return(true)); |
| download_manager_->CreateDownloadItem(info); |
| + delete info; |
| DownloadItem* download = GetActiveDownloadItem(0); |
| ASSERT_TRUE(download != NULL); |
| @@ -549,6 +543,7 @@ TEST_F(DownloadManagerTest, DownloadOverwriteTest) { |
| info->is_dangerous_url = false; |
| download_manager_->CreateDownloadItem(info); |
| + delete info; |
| DownloadItem* download = GetActiveDownloadItem(0); |
| ASSERT_TRUE(download != NULL); |
| @@ -567,6 +562,7 @@ TEST_F(DownloadManagerTest, DownloadOverwriteTest) { |
| download_file->Initialize(false); |
| // |download_file| is owned by DownloadFileManager. |
| AddDownloadToFileManager(info->download_id, download_file); |
| + delete info; |
| ContinueDownloadWithPath(download, new_path); |
| message_loop_.RunAllPending(); |