Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1886)

Unified Diff: chrome/browser/download/download_browsertest.cc

Issue 10912173: Replace the DownloadFileManager with direct ownership of DownloadFileImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to LKGR (r156083) Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/download/download_browsertest.cc
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc
index 21c0f3c2226703a6d26c8baf73e0ff90e27bc39b..46d8a55e79017bc032b56a07fbc56bc02083d6c5 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -197,6 +197,10 @@ class TestRenderViewContextMenu : public RenderViewContextMenu {
DISALLOW_COPY_AND_ASSIGN(TestRenderViewContextMenu);
};
+bool WasAutoOpened(DownloadItem* item) {
+ return item->GetAutoOpened();
+}
+
} // namespace
// While an object of this class exists, it will mock out download
@@ -778,7 +782,8 @@ class DownloadTest : public InProcessBrowserTest {
// Set up file failures.
scoped_refptr<content::TestFileErrorInjector> injector(
- content::TestFileErrorInjector::Create());
+ content::TestFileErrorInjector::Create(
+ DownloadManagerForBrowser(browser())));
for (size_t i = 0; i < count; ++i) {
// Set up the full URL, for download file tracking.
@@ -1562,7 +1567,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CrxDenyInstall) {
EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::CANCELLED));
EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen());
- // Download shelf should close. Download panel stays open on ChromeOS.
+ // Download shelf should close.
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
// Check that the CRX is not installed.
@@ -1595,7 +1600,12 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CrxInstallDenysPermissions) {
CheckDownloadStates(1, DownloadItem::COMPLETE);
EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen());
- // Download shelf should close. Download panel stays open on ChromeOS.
+ // Download shelf should close from auto-open.
+ content::DownloadManager::DownloadVector downloads;
+ DownloadManagerForBrowser(browser())->GetAllDownloads(&downloads);
+ ASSERT_EQ(1u, downloads.size());
+ content::DownloadUpdatedObserver(
+ downloads[0], base::Bind(WasAutoOpened)).WaitForEvent();
benjhayden 2012/09/12 21:01:01 Why don't you need/want the address-of '&' operato
Randy Smith (Not in Mondays) 2012/09/13 20:15:12 Done.
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
// Check that the extension was not installed.
@@ -1627,7 +1637,12 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CrxInstallAcceptPermissions) {
CheckDownloadStates(1, DownloadItem::COMPLETE);
EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen());
- // Download shelf should close. Download panel stays open on ChromeOS.
+ // Download shelf should close from auto-open.
+ content::DownloadManager::DownloadVector downloads;
+ DownloadManagerForBrowser(browser())->GetAllDownloads(&downloads);
+ ASSERT_EQ(1u, downloads.size());
+ content::DownloadUpdatedObserver(
+ downloads[0], base::Bind(WasAutoOpened)).WaitForEvent();
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
// Check that the extension was installed.
@@ -1684,7 +1699,12 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CrxLargeTheme) {
CheckDownloadStates(1, DownloadItem::COMPLETE);
EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen());
- // Download shelf should close. Download panel stays open on ChromeOS.
+ // Download shelf should close from auto-open.
+ content::DownloadManager::DownloadVector downloads;
+ DownloadManagerForBrowser(browser())->GetAllDownloads(&downloads);
+ ASSERT_EQ(1u, downloads.size());
+ content::DownloadUpdatedObserver(
+ downloads[0], base::Bind(WasAutoOpened)).WaitForEvent();
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
// Check that the extension was installed.

Powered by Google App Engine
This is Rietveld 408576698