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

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: Incorporated latest rounds of comments from John. 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/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
11 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
12 #include "chrome/browser/download/chrome_download_manager_delegate.h" 12 #include "chrome/browser/download/chrome_download_manager_delegate.h"
13 #include "chrome/browser/download/download_history.h" 13 #include "chrome/browser/download/download_history.h"
14 #include "chrome/browser/download/download_service.h"
15 #include "chrome/browser/download/download_service_factory.h"
14 #include "chrome/browser/net/url_request_mock_util.h" 16 #include "chrome/browser/net/url_request_mock_util.h"
15 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/webui/active_downloads_ui.h" 20 #include "chrome/browser/ui/webui/active_downloads_ui.h"
19 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
20 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
21 #include "chrome/test/base/in_process_browser_test.h" 23 #include "chrome/test/base/in_process_browser_test.h"
22 #include "chrome/test/base/ui_test_utils.h" 24 #include "chrome/test/base/ui_test_utils.h"
23 #include "content/browser/download/download_item.h" 25 #include "content/browser/download/download_item.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 118 }
117 } 119 }
118 EXPECT_TRUE(found); 120 EXPECT_TRUE(found);
119 #else 121 #else
120 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 122 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
121 #endif 123 #endif
122 } 124 }
123 125
124 DownloadManager* GetDownloadManager() const { 126 DownloadManager* GetDownloadManager() const {
125 DownloadManager* download_manager = 127 DownloadManager* download_manager =
126 browser()->profile()->GetDownloadManager(); 128 DownloadServiceFactory::GetForProfile(
129 browser()->profile())->GetDownloadManager();
127 EXPECT_TRUE(download_manager); 130 EXPECT_TRUE(download_manager);
128 return download_manager; 131 return download_manager;
129 } 132 }
130 133
131 void QueryDownloadHistory() { 134 void QueryDownloadHistory() {
132 // Query the history system. 135 // Query the history system.
133 ChromeDownloadManagerDelegate* delegate = 136 ChromeDownloadManagerDelegate* delegate =
134 static_cast<ChromeDownloadManagerDelegate*>( 137 static_cast<ChromeDownloadManagerDelegate*>(
135 GetDownloadManager()->delegate()); 138 GetDownloadManager()->delegate());
136 delegate->download_history()->Load( 139 delegate->download_history()->Load(
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, ExplicitCancel) { 349 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, ExplicitCancel) {
347 GURL url = NavigateToMockURL("a"); 350 GURL url = NavigateToMockURL("a");
348 FilePath full_file_name, dir; 351 FilePath full_file_name, dir;
349 GetDestinationPaths("a", &full_file_name, &dir); 352 GetDestinationPaths("a", &full_file_name, &dir);
350 scoped_refptr<SavePackage> save_package(new SavePackage(GetCurrentTab(), 353 scoped_refptr<SavePackage> save_package(new SavePackage(GetCurrentTab(),
351 SavePackage::SAVE_AS_ONLY_HTML, full_file_name, dir)); 354 SavePackage::SAVE_AS_ONLY_HTML, full_file_name, dir));
352 save_package->Cancel(true); 355 save_package->Cancel(true);
353 } 356 }
354 357
355 } // namespace 358 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/download/download_service_factory.cc ('k') | chrome/browser/extensions/extension_downloads_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698