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

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

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/scoped_temp_dir.h" 11 #include "base/scoped_temp_dir.h"
12 #include "base/test/test_file_util.h" 12 #include "base/test/test_file_util.h"
13 #include "chrome/app/chrome_command_ids.h" 13 #include "chrome/app/chrome_command_ids.h"
14 #include "chrome/browser/download/chrome_download_manager_delegate.h" 14 #include "chrome/browser/download/chrome_download_manager_delegate.h"
15 #include "chrome/browser/download/download_history.h" 15 #include "chrome/browser/download/download_history.h"
16 #include "chrome/browser/download/download_prefs.h" 16 #include "chrome/browser/download/download_prefs.h"
17 #include "chrome/browser/download/download_service.h" 17 #include "chrome/browser/download/download_service.h"
18 #include "chrome/browser/download/download_service_factory.h" 18 #include "chrome/browser/download/download_service_factory.h"
19 #include "chrome/browser/net/url_request_mock_util.h" 19 #include "chrome/browser/net/url_request_mock_util.h"
20 #include "chrome/browser/prefs/pref_member.h" 20 #include "chrome/browser/prefs/pref_member.h"
21 #include "chrome/browser/prefs/pref_service.h" 21 #include "chrome/browser/prefs/pref_service.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/browser_commands.h" 24 #include "chrome/browser/ui/browser_commands.h"
25 #include "chrome/browser/ui/browser_tabstrip.h"
25 #include "chrome/browser/ui/browser_window.h" 26 #include "chrome/browser/ui/browser_window.h"
26 #include "chrome/common/chrome_paths.h" 27 #include "chrome/common/chrome_paths.h"
27 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
28 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
29 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
30 #include "chrome/test/base/in_process_browser_test.h" 31 #include "chrome/test/base/in_process_browser_test.h"
31 #include "chrome/test/base/ui_test_utils.h" 32 #include "chrome/test/base/ui_test_utils.h"
32 #include "content/public/browser/download_item.h" 33 #include "content/public/browser/download_item.h"
33 #include "content/public/browser/download_manager.h" 34 #include "content/public/browser/download_manager.h"
34 #include "content/public/browser/download_persistent_store_info.h" 35 #include "content/public/browser/download_persistent_store_info.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 94
94 // Returns full paths of destination file and directory. 95 // Returns full paths of destination file and directory.
95 void GetDestinationPaths(const std::string& prefix, 96 void GetDestinationPaths(const std::string& prefix,
96 FilePath* full_file_name, 97 FilePath* full_file_name,
97 FilePath* dir) { 98 FilePath* dir) {
98 *full_file_name = save_dir_.path().AppendASCII(prefix + ".htm"); 99 *full_file_name = save_dir_.path().AppendASCII(prefix + ".htm");
99 *dir = save_dir_.path().AppendASCII(prefix + "_files"); 100 *dir = save_dir_.path().AppendASCII(prefix + "_files");
100 } 101 }
101 102
102 WebContents* GetCurrentTab() const { 103 WebContents* GetCurrentTab() const {
103 WebContents* current_tab = browser()->GetActiveWebContents(); 104 WebContents* current_tab = chrome::GetActiveWebContents(browser());
104 EXPECT_TRUE(current_tab); 105 EXPECT_TRUE(current_tab);
105 return current_tab; 106 return current_tab;
106 } 107 }
107 108
108 109
109 GURL WaitForSavePackageToFinish() const { 110 GURL WaitForSavePackageToFinish() const {
110 ui_test_utils::WindowedNotificationObserver observer( 111 ui_test_utils::WindowedNotificationObserver observer(
111 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, 112 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED,
112 content::NotificationService::AllSources()); 113 content::NotificationService::AllSources());
113 observer.Wait(); 114 observer.Wait();
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 content::NotificationService::AllSources()); 408 content::NotificationService::AllSources());
408 chrome::SavePage(browser()); 409 chrome::SavePage(browser());
409 observer.Wait(); 410 observer.Wait();
410 CheckDownloadHistory(url, full_file_name, -1); 411 CheckDownloadHistory(url, full_file_name, -1);
411 412
412 EXPECT_TRUE(file_util::PathExists(full_file_name)); 413 EXPECT_TRUE(file_util::PathExists(full_file_name));
413 int64 actual_file_size = -1; 414 int64 actual_file_size = -1;
414 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); 415 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size));
415 EXPECT_LE(kFileSizeMin, actual_file_size); 416 EXPECT_LE(kFileSizeMin, actual_file_size);
416 } 417 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_danger_prompt_browsertest.cc ('k') | chrome/browser/errorpage_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698