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

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

Issue 625113002: replace OVERRIDE and FINAL with override and final in chrome/browser/[a-i]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix newly added OVERRIDEs Created 6 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
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/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 bool WaitForPersisted() { 78 bool WaitForPersisted() {
79 if (persisted_) 79 if (persisted_)
80 return true; 80 return true;
81 waiting_ = true; 81 waiting_ = true;
82 content::RunMessageLoop(); 82 content::RunMessageLoop();
83 waiting_ = false; 83 waiting_ = false;
84 return persisted_; 84 return persisted_;
85 } 85 }
86 86
87 virtual void OnDownloadStored(DownloadItem* item, 87 virtual void OnDownloadStored(DownloadItem* item,
88 const history::DownloadRow& info) OVERRIDE { 88 const history::DownloadRow& info) override {
89 persisted_ = persisted_ || filter_.Run(item, info); 89 persisted_ = persisted_ || filter_.Run(item, info);
90 if (persisted_ && waiting_) 90 if (persisted_ && waiting_)
91 base::MessageLoopForUI::current()->Quit(); 91 base::MessageLoopForUI::current()->Quit();
92 } 92 }
93 93
94 private: 94 private:
95 Profile* profile_; 95 Profile* profile_;
96 PersistedFilter filter_; 96 PersistedFilter filter_;
97 bool waiting_; 97 bool waiting_;
98 bool persisted_; 98 bool persisted_;
(...skipping 15 matching lines...) Expand all
114 bool WaitForRemoved() { 114 bool WaitForRemoved() {
115 if (removed_) 115 if (removed_)
116 return true; 116 return true;
117 waiting_ = true; 117 waiting_ = true;
118 content::RunMessageLoop(); 118 content::RunMessageLoop();
119 waiting_ = false; 119 waiting_ = false;
120 return removed_; 120 return removed_;
121 } 121 }
122 122
123 virtual void OnDownloadStored(DownloadItem* item, 123 virtual void OnDownloadStored(DownloadItem* item,
124 const history::DownloadRow& info) OVERRIDE { 124 const history::DownloadRow& info) override {
125 } 125 }
126 126
127 virtual void OnDownloadsRemoved(const DownloadHistory::IdSet& ids) OVERRIDE { 127 virtual void OnDownloadsRemoved(const DownloadHistory::IdSet& ids) override {
128 removed_ = ids.find(download_id_) != ids.end(); 128 removed_ = ids.find(download_id_) != ids.end();
129 if (removed_ && waiting_) 129 if (removed_ && waiting_)
130 base::MessageLoopForUI::current()->Quit(); 130 base::MessageLoopForUI::current()->Quit();
131 } 131 }
132 132
133 private: 133 private:
134 bool removed_; 134 bool removed_;
135 bool waiting_; 135 bool waiting_;
136 int32 download_id_; 136 int32 download_id_;
137 137
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 waiting_ = false; 211 waiting_ = false;
212 } 212 }
213 213
214 *items_seen = items_seen_; 214 *items_seen = items_seen_;
215 return; 215 return;
216 } 216 }
217 217
218 private: 218 private:
219 // DownloadManager::Observer 219 // DownloadManager::Observer
220 virtual void OnDownloadCreated( 220 virtual void OnDownloadCreated(
221 DownloadManager* manager, DownloadItem* item) OVERRIDE { 221 DownloadManager* manager, DownloadItem* item) override {
222 DCHECK_EQ(manager, manager_); 222 DCHECK_EQ(manager, manager_);
223 items_seen_.push_back(item); 223 items_seen_.push_back(item);
224 224
225 if (waiting_) 225 if (waiting_)
226 base::MessageLoopForUI::current()->Quit(); 226 base::MessageLoopForUI::current()->Quit();
227 } 227 }
228 228
229 virtual void ManagerGoingDown(DownloadManager* manager) OVERRIDE { 229 virtual void ManagerGoingDown(DownloadManager* manager) override {
230 manager_->RemoveObserver(this); 230 manager_->RemoveObserver(this);
231 manager_ = NULL; 231 manager_ = NULL;
232 if (waiting_) 232 if (waiting_)
233 base::MessageLoopForUI::current()->Quit(); 233 base::MessageLoopForUI::current()->Quit();
234 } 234 }
235 235
236 bool waiting_; 236 bool waiting_;
237 DownloadManager* manager_; 237 DownloadManager* manager_;
238 std::vector<DownloadItem*> items_seen_; 238 std::vector<DownloadItem*> items_seen_;
239 239
240 DISALLOW_COPY_AND_ASSIGN(DownloadItemCreatedObserver); 240 DISALLOW_COPY_AND_ASSIGN(DownloadItemCreatedObserver);
241 }; 241 };
242 242
243 class SavePackageFinishedObserver : public content::DownloadManager::Observer { 243 class SavePackageFinishedObserver : public content::DownloadManager::Observer {
244 public: 244 public:
245 SavePackageFinishedObserver(content::DownloadManager* manager, 245 SavePackageFinishedObserver(content::DownloadManager* manager,
246 const base::Closure& callback) 246 const base::Closure& callback)
247 : download_manager_(manager), 247 : download_manager_(manager),
248 callback_(callback) { 248 callback_(callback) {
249 download_manager_->AddObserver(this); 249 download_manager_->AddObserver(this);
250 } 250 }
251 251
252 virtual ~SavePackageFinishedObserver() { 252 virtual ~SavePackageFinishedObserver() {
253 if (download_manager_) 253 if (download_manager_)
254 download_manager_->RemoveObserver(this); 254 download_manager_->RemoveObserver(this);
255 } 255 }
256 256
257 // DownloadManager::Observer: 257 // DownloadManager::Observer:
258 virtual void OnSavePackageSuccessfullyFinished( 258 virtual void OnSavePackageSuccessfullyFinished(
259 content::DownloadManager* manager, content::DownloadItem* item) OVERRIDE { 259 content::DownloadManager* manager, content::DownloadItem* item) override {
260 callback_.Run(); 260 callback_.Run();
261 } 261 }
262 virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE { 262 virtual void ManagerGoingDown(content::DownloadManager* manager) override {
263 download_manager_->RemoveObserver(this); 263 download_manager_->RemoveObserver(this);
264 download_manager_ = NULL; 264 download_manager_ = NULL;
265 } 265 }
266 266
267 private: 267 private:
268 content::DownloadManager* download_manager_; 268 content::DownloadManager* download_manager_;
269 base::Closure callback_; 269 base::Closure callback_;
270 270
271 DISALLOW_COPY_AND_ASSIGN(SavePackageFinishedObserver); 271 DISALLOW_COPY_AND_ASSIGN(SavePackageFinishedObserver);
272 }; 272 };
273 273
274 class SavePageBrowserTest : public InProcessBrowserTest { 274 class SavePageBrowserTest : public InProcessBrowserTest {
275 public: 275 public:
276 SavePageBrowserTest() {} 276 SavePageBrowserTest() {}
277 virtual ~SavePageBrowserTest(); 277 virtual ~SavePageBrowserTest();
278 278
279 protected: 279 protected:
280 virtual void SetUp() OVERRIDE { 280 virtual void SetUp() override {
281 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir_)); 281 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir_));
282 ASSERT_TRUE(save_dir_.CreateUniqueTempDir()); 282 ASSERT_TRUE(save_dir_.CreateUniqueTempDir());
283 InProcessBrowserTest::SetUp(); 283 InProcessBrowserTest::SetUp();
284 } 284 }
285 285
286 virtual void SetUpOnMainThread() OVERRIDE { 286 virtual void SetUpOnMainThread() override {
287 browser()->profile()->GetPrefs()->SetFilePath( 287 browser()->profile()->GetPrefs()->SetFilePath(
288 prefs::kDownloadDefaultDirectory, save_dir_.path()); 288 prefs::kDownloadDefaultDirectory, save_dir_.path());
289 browser()->profile()->GetPrefs()->SetFilePath( 289 browser()->profile()->GetPrefs()->SetFilePath(
290 prefs::kSaveFileDefaultDirectory, save_dir_.path()); 290 prefs::kSaveFileDefaultDirectory, save_dir_.path());
291 BrowserThread::PostTask( 291 BrowserThread::PostTask(
292 BrowserThread::IO, FROM_HERE, 292 BrowserThread::IO, FROM_HERE,
293 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); 293 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true));
294 } 294 }
295 295
296 GURL NavigateToMockURL(const std::string& prefix) { 296 GURL NavigateToMockURL(const std::string& prefix) {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 440
441 class DelayingDownloadManagerDelegate : public ChromeDownloadManagerDelegate { 441 class DelayingDownloadManagerDelegate : public ChromeDownloadManagerDelegate {
442 public: 442 public:
443 explicit DelayingDownloadManagerDelegate(Profile* profile) 443 explicit DelayingDownloadManagerDelegate(Profile* profile)
444 : ChromeDownloadManagerDelegate(profile) { 444 : ChromeDownloadManagerDelegate(profile) {
445 } 445 }
446 virtual ~DelayingDownloadManagerDelegate() {} 446 virtual ~DelayingDownloadManagerDelegate() {}
447 447
448 virtual bool ShouldCompleteDownload( 448 virtual bool ShouldCompleteDownload(
449 content::DownloadItem* item, 449 content::DownloadItem* item,
450 const base::Closure& user_complete_callback) OVERRIDE { 450 const base::Closure& user_complete_callback) override {
451 return false; 451 return false;
452 } 452 }
453 453
454 private: 454 private:
455 DISALLOW_COPY_AND_ASSIGN(DelayingDownloadManagerDelegate); 455 DISALLOW_COPY_AND_ASSIGN(DelayingDownloadManagerDelegate);
456 }; 456 };
457 457
458 // Disabled on Windows due to flakiness. http://crbug.com/162323 458 // Disabled on Windows due to flakiness. http://crbug.com/162323
459 #if defined(OS_WIN) 459 #if defined(OS_WIN)
460 #define MAYBE_SaveHTMLOnlyTabDestroy DISABLED_SaveHTMLOnlyTabDestroy 460 #define MAYBE_SaveHTMLOnlyTabDestroy DISABLED_SaveHTMLOnlyTabDestroy
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 744
745 EXPECT_TRUE(base::DieFileDie(full_file_name, false)); 745 EXPECT_TRUE(base::DieFileDie(full_file_name, false));
746 EXPECT_TRUE(base::DieFileDie(dir, true)); 746 EXPECT_TRUE(base::DieFileDie(dir, true));
747 } 747 }
748 #endif 748 #endif
749 749
750 class SavePageAsMHTMLBrowserTest : public SavePageBrowserTest { 750 class SavePageAsMHTMLBrowserTest : public SavePageBrowserTest {
751 public: 751 public:
752 SavePageAsMHTMLBrowserTest() {} 752 SavePageAsMHTMLBrowserTest() {}
753 virtual ~SavePageAsMHTMLBrowserTest(); 753 virtual ~SavePageAsMHTMLBrowserTest();
754 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 754 virtual void SetUpCommandLine(CommandLine* command_line) override {
755 command_line->AppendSwitch(switches::kSavePageAsMHTML); 755 command_line->AppendSwitch(switches::kSavePageAsMHTML);
756 } 756 }
757 757
758 private: 758 private:
759 DISALLOW_COPY_AND_ASSIGN(SavePageAsMHTMLBrowserTest); 759 DISALLOW_COPY_AND_ASSIGN(SavePageAsMHTMLBrowserTest);
760 }; 760 };
761 761
762 SavePageAsMHTMLBrowserTest::~SavePageAsMHTMLBrowserTest() { 762 SavePageAsMHTMLBrowserTest::~SavePageAsMHTMLBrowserTest() {
763 } 763 }
764 764
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 base::FilePath download_dir = DownloadPrefs::FromDownloadManager( 803 base::FilePath download_dir = DownloadPrefs::FromDownloadManager(
804 GetDownloadManager())->DownloadPath(); 804 GetDownloadManager())->DownloadPath();
805 base::FilePath filename = download_dir.AppendASCII("dataurl.txt"); 805 base::FilePath filename = download_dir.AppendASCII("dataurl.txt");
806 ASSERT_TRUE(base::PathExists(filename)); 806 ASSERT_TRUE(base::PathExists(filename));
807 std::string contents; 807 std::string contents;
808 EXPECT_TRUE(base::ReadFileToString(filename, &contents)); 808 EXPECT_TRUE(base::ReadFileToString(filename, &contents));
809 EXPECT_EQ("foo", contents); 809 EXPECT_EQ("foo", contents);
810 } 810 }
811 811
812 } // namespace 812 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/download/save_package_file_picker.h ('k') | chrome/browser/download/test_download_shelf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698