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

Side by Side Diff: chrome/browser/download/download_browsertest.cc

Issue 12047039: download: Remove DownloadManager::MockDownloadOpenForTesting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <sstream> 5 #include <sstream>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 } 1456 }
1457 1457
1458 // Test to make sure auto-open works. 1458 // Test to make sure auto-open works.
1459 IN_PROC_BROWSER_TEST_F(DownloadTest, AutoOpen) { 1459 IN_PROC_BROWSER_TEST_F(DownloadTest, AutoOpen) {
1460 FilePath file(FILE_PATH_LITERAL("download-autoopen.txt")); 1460 FilePath file(FILE_PATH_LITERAL("download-autoopen.txt"));
1461 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 1461 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
1462 1462
1463 ASSERT_TRUE( 1463 ASSERT_TRUE(
1464 GetDownloadPrefs(browser())->EnableAutoOpenBasedOnExtension(file)); 1464 GetDownloadPrefs(browser())->EnableAutoOpenBasedOnExtension(file));
1465 1465
1466 DownloadManagerForBrowser(browser())->MockDownloadOpenForTesting();
1467
1468 DownloadAndWait(browser(), url); 1466 DownloadAndWait(browser(), url);
1469 1467
1470 // Find the download and confirm it was opened. 1468 // Find the download and confirm it was opened.
1471 std::vector<DownloadItem*> downloads; 1469 std::vector<DownloadItem*> downloads;
1472 DownloadManagerForBrowser(browser())->GetAllDownloads(&downloads); 1470 DownloadManagerForBrowser(browser())->GetAllDownloads(&downloads);
1473 ASSERT_EQ(1u, downloads.size()); 1471 ASSERT_EQ(1u, downloads.size());
1474 EXPECT_EQ(DownloadItem::COMPLETE, downloads[0]->GetState()); 1472 EXPECT_EQ(DownloadItem::COMPLETE, downloads[0]->GetState());
1475 1473
1476 // Unfortunately, this will block forever, causing a timeout, if 1474 // Unfortunately, this will block forever, causing a timeout, if
1477 // the download is never opened. 1475 // the download is never opened.
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 WebContents* web_contents = chrome::GetActiveWebContents(browser()); 2198 WebContents* web_contents = chrome::GetActiveWebContents(browser());
2201 scoped_ptr<DownloadUrlParameters> params( 2199 scoped_ptr<DownloadUrlParameters> params(
2202 DownloadUrlParameters::FromWebContents(web_contents, url)); 2200 DownloadUrlParameters::FromWebContents(web_contents, url));
2203 params->set_callback(base::Bind(&SetHiddenDownloadCallback)); 2201 params->set_callback(base::Bind(&SetHiddenDownloadCallback));
2204 download_manager->DownloadUrl(params.Pass()); 2202 download_manager->DownloadUrl(params.Pass());
2205 observer->WaitForFinished(); 2203 observer->WaitForFinished();
2206 2204
2207 // Verify that download shelf is not shown. 2205 // Verify that download shelf is not shown.
2208 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 2206 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
2209 } 2207 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698