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

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

Issue 10918136: Make web store resilient against download completion happening before opening. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile errors. 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..18dad28d68776915950f773c563980316e6043d9 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
@@ -1562,7 +1566,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 +1599,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 17:42:14 Why don't you need/want the & address-of operator
Randy Smith (Not in Mondays) 2012/09/12 19:11:39 Pure oversight. I'm not sure why the compiler did
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
// Check that the extension was not installed.
@@ -1627,7 +1636,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 +1698,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.
« no previous file with comments | « chrome/browser/download/chrome_download_manager_delegate.cc ('k') | content/public/test/download_test_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698