| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |