| 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 "chrome/browser/download/download_browsertest.h" | 5 #include "chrome/browser/download/download_browsertest.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 | 1089 |
| 1090 // Location of the test data. | 1090 // Location of the test data. |
| 1091 base::FilePath test_dir_; | 1091 base::FilePath test_dir_; |
| 1092 | 1092 |
| 1093 // Location of the downloads directory for these tests | 1093 // Location of the downloads directory for these tests |
| 1094 base::ScopedTempDir downloads_directory_; | 1094 base::ScopedTempDir downloads_directory_; |
| 1095 | 1095 |
| 1096 scoped_ptr<DownloadTestFileActivityObserver> file_activity_observer_; | 1096 scoped_ptr<DownloadTestFileActivityObserver> file_activity_observer_; |
| 1097 }; | 1097 }; |
| 1098 | 1098 |
| 1099 namespace { |
| 1100 |
| 1099 class FakeDownloadProtectionService | 1101 class FakeDownloadProtectionService |
| 1100 : public safe_browsing::DownloadProtectionService { | 1102 : public safe_browsing::DownloadProtectionService { |
| 1101 public: | 1103 public: |
| 1102 FakeDownloadProtectionService() | 1104 FakeDownloadProtectionService() |
| 1103 : safe_browsing::DownloadProtectionService(nullptr, nullptr) {} | 1105 : safe_browsing::DownloadProtectionService(nullptr, nullptr) {} |
| 1104 | 1106 |
| 1105 void CheckClientDownload(DownloadItem* download_item, | 1107 void CheckClientDownload(DownloadItem* download_item, |
| 1106 const CheckDownloadCallback& callback) override { | 1108 const CheckDownloadCallback& callback) override { |
| 1107 callback.Run( | 1109 callback.Run( |
| 1108 safe_browsing::DownloadProtectionService::UNCOMMON); | 1110 safe_browsing::DownloadProtectionService::UNCOMMON); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 | 1166 |
| 1165 void TearDown() override { | 1167 void TearDown() override { |
| 1166 safe_browsing::SafeBrowsingService::RegisterFactory(nullptr); | 1168 safe_browsing::SafeBrowsingService::RegisterFactory(nullptr); |
| 1167 DownloadTest::TearDown(); | 1169 DownloadTest::TearDown(); |
| 1168 } | 1170 } |
| 1169 | 1171 |
| 1170 protected: | 1172 protected: |
| 1171 scoped_ptr<TestSafeBrowsingServiceFactory> test_safe_browsing_factory_; | 1173 scoped_ptr<TestSafeBrowsingServiceFactory> test_safe_browsing_factory_; |
| 1172 }; | 1174 }; |
| 1173 | 1175 |
| 1176 } // namespace |
| 1177 |
| 1174 // NOTES: | 1178 // NOTES: |
| 1175 // | 1179 // |
| 1176 // Files for these tests are found in DIR_TEST_DATA (currently | 1180 // Files for these tests are found in DIR_TEST_DATA (currently |
| 1177 // "chrome\test\data\", see chrome_paths.cc). | 1181 // "chrome\test\data\", see chrome_paths.cc). |
| 1178 // Mock responses have extension .mock-http-headers appended to the file name. | 1182 // Mock responses have extension .mock-http-headers appended to the file name. |
| 1179 | 1183 |
| 1180 // Download a file due to the associated MIME type. | 1184 // Download a file due to the associated MIME type. |
| 1181 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeType) { | 1185 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeType) { |
| 1182 GURL url(URLRequestMockHTTPJob::GetMockUrl(kDownloadTest1Path)); | 1186 GURL url(URLRequestMockHTTPJob::GetMockUrl(kDownloadTest1Path)); |
| 1183 | 1187 |
| (...skipping 2501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3685 | 3689 |
| 3686 scoped_ptr<content::DownloadTestObserver> observer(DangerousDownloadWaiter( | 3690 scoped_ptr<content::DownloadTestObserver> observer(DangerousDownloadWaiter( |
| 3687 browser(), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); | 3691 browser(), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); |
| 3688 ui_test_utils::NavigateToURL(browser(), extension_url); | 3692 ui_test_utils::NavigateToURL(browser(), extension_url); |
| 3689 | 3693 |
| 3690 observer->WaitForFinished(); | 3694 observer->WaitForFinished(); |
| 3691 | 3695 |
| 3692 // Download shelf should close. | 3696 // Download shelf should close. |
| 3693 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 3697 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
| 3694 } | 3698 } |
| OLD | NEW |