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

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

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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
« no previous file with comments | « chrome/browser/download/download_util.cc ('k') | chrome/browser/enumerate_modules_model_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 14 #include "chrome/browser/download/download_service.h"
15 #include "chrome/browser/download/download_service_factory.h" 15 #include "chrome/browser/download/download_service_factory.h"
16 #include "chrome/browser/net/url_request_mock_util.h" 16 #include "chrome/browser/net/url_request_mock_util.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/webui/active_downloads_ui.h" 20 #include "chrome/browser/ui/webui/active_downloads_ui.h"
21 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
22 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
23 #include "chrome/test/base/in_process_browser_test.h" 23 #include "chrome/test/base/in_process_browser_test.h"
24 #include "chrome/test/base/ui_test_utils.h" 24 #include "chrome/test/base/ui_test_utils.h"
25 #include "content/browser/download/download_item.h" 25 #include "content/browser/download/download_item.h"
26 #include "content/browser/download/download_manager.h" 26 #include "content/browser/download/download_manager.h"
27 #include "content/browser/download/download_persistent_store_info.h" 27 #include "content/browser/download/download_persistent_store_info.h"
28 #include "content/browser/net/url_request_mock_http_job.h" 28 #include "content/browser/net/url_request_mock_http_job.h"
29 #include "content/browser/tab_contents/tab_contents.h" 29 #include "content/browser/tab_contents/tab_contents.h"
30 #include "content/common/notification_service.h" 30 #include "content/public/browser/notification_service.h"
31 #include "content/public/browser/notification_types.h" 31 #include "content/public/browser/notification_types.h"
32 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
33 33
34 namespace { 34 namespace {
35 35
36 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("save_page"); 36 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("save_page");
37 37
38 static const char* kAppendedExtension = 38 static const char* kAppendedExtension =
39 #if defined(OS_WIN) 39 #if defined(OS_WIN)
40 ".htm"; 40 ".htm";
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 TabContents* current_tab = browser()->GetSelectedTabContents(); 75 TabContents* current_tab = browser()->GetSelectedTabContents();
76 EXPECT_TRUE(current_tab); 76 EXPECT_TRUE(current_tab);
77 return current_tab; 77 return current_tab;
78 } 78 }
79 79
80 80
81 GURL WaitForSavePackageToFinish() const { 81 GURL WaitForSavePackageToFinish() const {
82 ui_test_utils::TestNotificationObserver observer; 82 ui_test_utils::TestNotificationObserver observer;
83 ui_test_utils::RegisterAndWait(&observer, 83 ui_test_utils::RegisterAndWait(&observer,
84 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, 84 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED,
85 NotificationService::AllSources()); 85 content::NotificationService::AllSources());
86 return content::Details<DownloadItem>(observer.details()).ptr()-> 86 return content::Details<DownloadItem>(observer.details()).ptr()->
87 original_url(); 87 original_url();
88 } 88 }
89 89
90 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) 90 #if defined(OS_CHROMEOS) && defined(TOUCH_UI)
91 const ActiveDownloadsUI::DownloadList& GetDownloads() const { 91 const ActiveDownloadsUI::DownloadList& GetDownloads() const {
92 TabContents* download_contents = ActiveDownloadsUI::GetPopup(NULL); 92 TabContents* download_contents = ActiveDownloadsUI::GetPopup(NULL);
93 ActiveDownloadsUI* downloads_ui = static_cast<ActiveDownloadsUI*>( 93 ActiveDownloadsUI* downloads_ui = static_cast<ActiveDownloadsUI*>(
94 download_contents->web_ui()); 94 download_contents->web_ui());
95 EXPECT_TRUE(downloads_ui); 95 EXPECT_TRUE(downloads_ui);
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, ExplicitCancel) { 350 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, ExplicitCancel) {
351 GURL url = NavigateToMockURL("a"); 351 GURL url = NavigateToMockURL("a");
352 FilePath full_file_name, dir; 352 FilePath full_file_name, dir;
353 GetDestinationPaths("a", &full_file_name, &dir); 353 GetDestinationPaths("a", &full_file_name, &dir);
354 scoped_refptr<SavePackage> save_package(new SavePackage(GetCurrentTab(), 354 scoped_refptr<SavePackage> save_package(new SavePackage(GetCurrentTab(),
355 SavePackage::SAVE_AS_ONLY_HTML, full_file_name, dir)); 355 SavePackage::SAVE_AS_ONLY_HTML, full_file_name, dir));
356 save_package->Cancel(true); 356 save_package->Cancel(true);
357 } 357 }
358 358
359 } // namespace 359 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/download/download_util.cc ('k') | chrome/browser/enumerate_modules_model_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698