Index: chrome/browser/download/download_browsertest.cc |
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc |
index 06fc2a41a9018738b0499794394e875aa72161d1..db06c0d9aa680722eccc9e3da534ac3ab1daddea 100644 |
--- a/chrome/browser/download/download_browsertest.cc |
+++ b/chrome/browser/download/download_browsertest.cc |
@@ -1407,128 +1407,6 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, NewWindow) { |
CheckDownload(browser(), file, file); |
} |
-// Check that downloading multiple (in this case, 2) files does not result in |
-// corrupted files. |
-IN_PROC_BROWSER_TEST_F(DownloadTest, MultiDownload) { |
- EXPECT_EQ(1, browser()->tab_count()); |
- |
- // Create a download, wait until it's started, and confirm |
- // we're in the expected state. |
- scoped_ptr<content::DownloadTestObserver> observer1( |
- CreateInProgressWaiter(browser(), 1)); |
- ui_test_utils::NavigateToURL( |
- browser(), GURL(URLRequestSlowDownloadJob::kUnknownSizeUrl)); |
- observer1->WaitForFinished(); |
- |
- std::vector<DownloadItem*> downloads; |
- DownloadManagerForBrowser(browser())->SearchDownloads( |
- string16(), &downloads); |
- ASSERT_EQ(1u, downloads.size()); |
- ASSERT_EQ(DownloadItem::IN_PROGRESS, downloads[0]->GetState()); |
- EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
- DownloadItem* download1 = downloads[0]; // The only download. |
- |
- // Start the second download and wait until it's done. |
- FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
- GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
- // Download the file and wait. We do not expect the Select File dialog. |
- DownloadAndWait(browser(), url); |
- |
- // Should now have 2 items on the download shelf. |
- downloads.clear(); |
- DownloadManagerForBrowser(browser())->SearchDownloads( |
- string16(), &downloads); |
- ASSERT_EQ(2u, downloads.size()); |
- // We don't know the order of the downloads. |
- DownloadItem* download2 = downloads[(download1 == downloads[0]) ? 1 : 0]; |
- |
- ASSERT_EQ(DownloadItem::IN_PROGRESS, download1->GetState()); |
- ASSERT_EQ(DownloadItem::COMPLETE, download2->GetState()); |
- // The download shelf should be open. |
- EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
- |
- // Allow the first request to finish. We do this by loading a third URL |
- // in a separate tab. |
- scoped_ptr<content::DownloadTestObserver> observer2( |
- CreateWaiter(browser(), 1)); |
- GURL finish_url(URLRequestSlowDownloadJob::kFinishDownloadUrl); |
- ui_test_utils::NavigateToURLWithDisposition( |
- browser(), |
- finish_url, |
- NEW_FOREGROUND_TAB, |
- ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
- observer2->WaitForFinished(); // Wait for the third request. |
- EXPECT_EQ(1u, observer2->NumDownloadsSeenInState(DownloadItem::COMPLETE)); |
- |
- // Get the important info from other threads and check it. |
- EXPECT_TRUE(EnsureNoPendingDownloads()); |
- |
- EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
- |
- // The |DownloadItem|s should now be done and have the final file names. |
- // Verify that the files have the expected data and size. |
- // |file1| should be full of '*'s, and |file2| should be the same as the |
- // source file. |
- FilePath file1(download1->GetFullPath()); |
- size_t file_size1 = URLRequestSlowDownloadJob::kFirstDownloadSize + |
- URLRequestSlowDownloadJob::kSecondDownloadSize; |
- std::string expected_contents(file_size1, '*'); |
- ASSERT_TRUE(VerifyFile(file1, expected_contents, file_size1)); |
- |
- FilePath file2(download2->GetFullPath()); |
- ASSERT_TRUE(file_util::ContentsEqual(OriginFile(file), file2)); |
-} |
- |
-IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadCancelled) { |
- EXPECT_EQ(1, browser()->tab_count()); |
- |
- // TODO(rdsmith): Fragile code warning! The code below relies on the |
- // DownloadTestObserverInProgress only finishing when the new download |
- // has reached the state of being entered into the history and being |
- // user-visible (that's what's required for the Remove to be valid and |
- // for the download shelf to be visible). By the pure semantics of |
- // DownloadTestObserverInProgress, that's not guaranteed; DownloadItems |
- // are created in the IN_PROGRESS state and made known to the DownloadManager |
- // immediately, so any ModelChanged event on the DownloadManager after |
- // navigation would allow the observer to return. However, the only |
- // ModelChanged() event the code will currently fire is in |
- // OnCreateDownloadEntryComplete, at which point the download item will |
- // be in the state we need. |
- // The right way to fix this is to create finer grained states on the |
- // DownloadItem, and wait for the state that indicates the item has been |
- // entered in the history and made visible in the UI. |
- |
- // Create a download, wait until it's started, and confirm |
- // we're in the expected state. |
- scoped_ptr<content::DownloadTestObserver> observer( |
- CreateInProgressWaiter(browser(), 1)); |
- ui_test_utils::NavigateToURL( |
- browser(), GURL(URLRequestSlowDownloadJob::kUnknownSizeUrl)); |
- observer->WaitForFinished(); |
- |
- std::vector<DownloadItem*> downloads; |
- DownloadManagerForBrowser(browser())->SearchDownloads( |
- string16(), &downloads); |
- ASSERT_EQ(1u, downloads.size()); |
- ASSERT_EQ(DownloadItem::IN_PROGRESS, downloads[0]->GetState()); |
- EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
- |
- // Cancel the download and wait for download system quiesce. |
- downloads[0]->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); |
- scoped_refptr<content::DownloadTestFlushObserver> flush_observer( |
- new content::DownloadTestFlushObserver( |
- DownloadManagerForBrowser(browser()))); |
- flush_observer->WaitForFlush(); |
- |
- // Get the important info from other threads and check it. |
- EXPECT_TRUE(EnsureNoPendingDownloads()); |
- |
- // Using "DownloadItem::Remove" follows the discard dangerous download path, |
- // which completely removes the browser from the shelf and closes the shelf |
- // if it was there. Download panel stays open on ChromeOS. |
- EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
-} |
- |
// Confirm a download makes it into the history properly. |
IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryCheck) { |
FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |