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

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

Issue 8135017: Refactor downloads into a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to LKGR to run try bots. Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
11 #include "chrome/browser/download/chrome_download_manager_delegate.h" 11 #include "chrome/browser/download/chrome_download_manager_delegate.h"
12 #include "chrome/browser/download/download_history.h" 12 #include "chrome/browser/download/download_history.h"
13 #include "chrome/browser/download/download_service.h"
14 #include "chrome/browser/download/download_service_factory.h"
13 #include "chrome/browser/net/url_request_mock_util.h" 15 #include "chrome/browser/net/url_request_mock_util.h"
14 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
17 #include "chrome/browser/ui/webui/active_downloads_ui.h" 19 #include "chrome/browser/ui/webui/active_downloads_ui.h"
18 #include "chrome/common/chrome_paths.h" 20 #include "chrome/common/chrome_paths.h"
19 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
20 #include "chrome/test/base/in_process_browser_test.h" 22 #include "chrome/test/base/in_process_browser_test.h"
21 #include "chrome/test/base/ui_test_utils.h" 23 #include "chrome/test/base/ui_test_utils.h"
22 #include "content/browser/download/download_item.h" 24 #include "content/browser/download/download_item.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 117 }
116 } 118 }
117 EXPECT_TRUE(found); 119 EXPECT_TRUE(found);
118 #else 120 #else
119 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 121 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
120 #endif 122 #endif
121 } 123 }
122 124
123 DownloadManager* GetDownloadManager() const { 125 DownloadManager* GetDownloadManager() const {
124 DownloadManager* download_manager = 126 DownloadManager* download_manager =
125 browser()->profile()->GetDownloadManager(); 127 DownloadServiceFactory::GetForProfile(
128 browser()->profile())->GetDownloadManager();
126 EXPECT_TRUE(download_manager); 129 EXPECT_TRUE(download_manager);
127 return download_manager; 130 return download_manager;
128 } 131 }
129 132
130 void QueryDownloadHistory() { 133 void QueryDownloadHistory() {
131 // Query the history system. 134 // Query the history system.
132 ChromeDownloadManagerDelegate* delegate = 135 ChromeDownloadManagerDelegate* delegate =
133 static_cast<ChromeDownloadManagerDelegate*>( 136 static_cast<ChromeDownloadManagerDelegate*>(
134 GetDownloadManager()->delegate()); 137 GetDownloadManager()->delegate());
135 delegate->download_history()->Load( 138 delegate->download_history()->Load(
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, ExplicitCancel) { 348 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, ExplicitCancel) {
346 GURL url = NavigateToMockURL("a"); 349 GURL url = NavigateToMockURL("a");
347 FilePath full_file_name, dir; 350 FilePath full_file_name, dir;
348 GetDestinationPaths("a", &full_file_name, &dir); 351 GetDestinationPaths("a", &full_file_name, &dir);
349 scoped_refptr<SavePackage> save_package(new SavePackage(GetCurrentTab(), 352 scoped_refptr<SavePackage> save_package(new SavePackage(GetCurrentTab(),
350 SavePackage::SAVE_AS_ONLY_HTML, full_file_name, dir)); 353 SavePackage::SAVE_AS_ONLY_HTML, full_file_name, dir));
351 save_package->Cancel(true); 354 save_package->Cancel(true);
352 } 355 }
353 356
354 } // namespace 357 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698