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

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

Issue 11050003: Shift EnsureNoPendingDownloads() implementation into tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 b0f7552aba9c35adfe668631faf31f8357f9d6be..049b907589d96701688145d6b26bc4b4e984d884 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -813,15 +813,6 @@ class DownloadTest : public InProcessBrowserTest {
}
}
- bool EnsureNoPendingDownloads() {
- bool result = true;
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(&EnsureNoPendingDownloadJobsOnIO, &result));
- MessageLoop::current()->Run();
- return result && DownloadManager::EnsureNoPendingDownloadsForTesting();
- }
-
// A mock install prompt that simulates the user allowing an install request.
void SetAllowMockInstallPrompt() {
gfx::NativeWindow parent =
@@ -988,7 +979,9 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadResourceThrottleCancels) {
ui_test_utils::NavigateToURL(browser(), same_site_url);
// Make sure the initial navigation didn't trigger a download.
- EXPECT_TRUE(EnsureNoPendingDownloads());
+ std::vector<content::DownloadItem*> items;
+ DownloadManagerForBrowser(browser())->GetAllDownloads(&items);
+ EXPECT_EQ(0u, items.size());
// Disable downloads for the tab.
WebContents* web_contents = chrome::GetActiveWebContents(browser());
@@ -1027,8 +1020,11 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadResourceThrottleCancels) {
EXPECT_EQ(1, browser()->tab_count());
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
- // Verify that there's no pending download.
- EXPECT_TRUE(EnsureNoPendingDownloads());
+ // Verify that there's no pending download. The resource throttle
+ // should have deleted it before it created a download item, so it
+ // shouldn't be available as a cancelled download either.
+ DownloadManagerForBrowser(browser())->GetAllDownloads(&items);
+ EXPECT_EQ(0u, items.size());
}
// Download a 0-size file with a content-disposition header, verify that the
« no previous file with comments | « no previous file | content/browser/download/download_browsertest.cc » ('j') | content/browser/download/download_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698