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

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

Issue 1471073008: Do not do unnecessary recursive deletes for files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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 <sstream> 5 #include <sstream>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 if (!downloaded_path_exists) 786 if (!downloaded_path_exists)
787 return false; 787 return false;
788 788
789 // Check the file contents. 789 // Check the file contents.
790 size_t file_size = net::URLRequestSlowDownloadJob::kFirstDownloadSize + 790 size_t file_size = net::URLRequestSlowDownloadJob::kFirstDownloadSize +
791 net::URLRequestSlowDownloadJob::kSecondDownloadSize; 791 net::URLRequestSlowDownloadJob::kSecondDownloadSize;
792 std::string expected_contents(file_size, '*'); 792 std::string expected_contents(file_size, '*');
793 EXPECT_TRUE(VerifyFile(download_path, expected_contents, file_size)); 793 EXPECT_TRUE(VerifyFile(download_path, expected_contents, file_size));
794 794
795 // Delete the file we just downloaded. 795 // Delete the file we just downloaded.
796 EXPECT_TRUE(base::DieFileDie(download_path, true)); 796 EXPECT_TRUE(base::DieFileDie(download_path, false));
797 EXPECT_FALSE(base::PathExists(download_path)); 797 EXPECT_FALSE(base::PathExists(download_path));
798 798
799 return true; 799 return true;
800 } 800 }
801 801
802 void GetDownloads(Browser* browser, 802 void GetDownloads(Browser* browser,
803 std::vector<DownloadItem*>* downloads) const { 803 std::vector<DownloadItem*>* downloads) const {
804 DCHECK(downloads); 804 DCHECK(downloads);
805 DownloadManager* manager = DownloadManagerForBrowser(browser); 805 DownloadManager* manager = DownloadManagerForBrowser(browser);
806 manager->GetAllDownloads(downloads); 806 manager->GetAllDownloads(downloads);
(...skipping 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after
3674 3674
3675 scoped_ptr<content::DownloadTestObserver> observer(DangerousDownloadWaiter( 3675 scoped_ptr<content::DownloadTestObserver> observer(DangerousDownloadWaiter(
3676 browser(), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); 3676 browser(), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY));
3677 ui_test_utils::NavigateToURL(browser(), extension_url); 3677 ui_test_utils::NavigateToURL(browser(), extension_url);
3678 3678
3679 observer->WaitForFinished(); 3679 observer->WaitForFinished();
3680 3680
3681 // Download shelf should close. 3681 // Download shelf should close.
3682 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 3682 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
3683 } 3683 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system_logs/debug_log_writer.cc ('k') | chrome/browser/profiles/profile_info_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698