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

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

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 // Get History Information. 93 // Get History Information.
94 class DownloadsHistoryDataCollector { 94 class DownloadsHistoryDataCollector {
95 public: 95 public:
96 DownloadsHistoryDataCollector(int64 download_db_handle, 96 DownloadsHistoryDataCollector(int64 download_db_handle,
97 DownloadManager* manager) 97 DownloadManager* manager)
98 : result_valid_(false), 98 : result_valid_(false),
99 download_db_handle_(download_db_handle) { 99 download_db_handle_(download_db_handle) {
100 HistoryService* hs = HistoryServiceFactory::GetForProfile( 100 HistoryService* hs = HistoryServiceFactory::GetForProfile(
101 Profile::FromBrowserContext(manager->GetBrowserContext()), 101 Profile::FromBrowserContext(manager->GetBrowserContext()),
102 Profile::EXPLICIT_ACCESS); 102 Profile::EXPLICIT_ACCESS).get();
103 DCHECK(hs); 103 DCHECK(hs);
104 hs->QueryDownloads( 104 hs->QueryDownloads(
105 &callback_consumer_, 105 &callback_consumer_,
106 base::Bind(&DownloadsHistoryDataCollector::OnQueryDownloadsComplete, 106 base::Bind(&DownloadsHistoryDataCollector::OnQueryDownloadsComplete,
107 base::Unretained(this))); 107 base::Unretained(this)));
108 108
109 // TODO(rdsmith): Move message loop out of constructor. 109 // TODO(rdsmith): Move message loop out of constructor.
110 // Cannot complete immediately because the history backend runs on a 110 // Cannot complete immediately because the history backend runs on a
111 // separate thread, so we can assume that the RunMessageLoop below will 111 // separate thread, so we can assume that the RunMessageLoop below will
112 // be exited by the Quit in OnQueryDownloadsComplete. 112 // be exited by the Quit in OnQueryDownloadsComplete.
(...skipping 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2264 } 2264 }
2265 2265
2266 IN_PROC_BROWSER_TEST_F(DownloadTest, HiddenDownload) { 2266 IN_PROC_BROWSER_TEST_F(DownloadTest, HiddenDownload) {
2267 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 2267 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
2268 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 2268 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
2269 2269
2270 scoped_refptr<DownloadManager> download_manager = 2270 scoped_refptr<DownloadManager> download_manager =
2271 DownloadManagerForBrowser(browser()); 2271 DownloadManagerForBrowser(browser());
2272 scoped_ptr<content::DownloadTestObserver> observer( 2272 scoped_ptr<content::DownloadTestObserver> observer(
2273 new content::DownloadTestObserverTerminal( 2273 new content::DownloadTestObserverTerminal(
2274 download_manager, 2274 download_manager.get(),
2275 1, 2275 1,
2276 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); 2276 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL));
2277 scoped_ptr<content::DownloadSaveInfo> save_info( 2277 scoped_ptr<content::DownloadSaveInfo> save_info(
2278 new content::DownloadSaveInfo()); 2278 new content::DownloadSaveInfo());
2279 save_info->prompt_for_save_location = false; 2279 save_info->prompt_for_save_location = false;
2280 2280
2281 // Download and set IsHiddenDownload to true. 2281 // Download and set IsHiddenDownload to true.
2282 WebContents* web_contents = chrome::GetActiveWebContents(browser()); 2282 WebContents* web_contents = chrome::GetActiveWebContents(browser());
2283 scoped_ptr<DownloadUrlParameters> params( 2283 scoped_ptr<DownloadUrlParameters> params(
2284 DownloadUrlParameters::FromWebContents( 2284 DownloadUrlParameters::FromWebContents(
2285 web_contents, url, save_info.Pass())); 2285 web_contents, url, save_info.Pass()));
2286 params->set_callback(base::Bind(&SetHiddenDownloadCallback)); 2286 params->set_callback(base::Bind(&SetHiddenDownloadCallback));
2287 download_manager->DownloadUrl(params.Pass()); 2287 download_manager->DownloadUrl(params.Pass());
2288 observer->WaitForFinished(); 2288 observer->WaitForFinished();
2289 2289
2290 // Verify that download shelf is not shown. 2290 // Verify that download shelf is not shown.
2291 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 2291 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
2292 } 2292 }
OLDNEW
« no previous file with comments | « chrome/browser/custom_home_pages_table_model.cc ('k') | chrome/browser/extensions/api/browsing_data/browsing_data_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698