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 "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/scoped_temp_dir.h" |
7 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
8 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
9 #include "base/scoped_temp_dir.h" | |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/value_conversions.h" | 12 #include "base/value_conversions.h" |
13 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 13 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
14 #include "chrome/browser/download/download_prefs.h" | 14 #include "chrome/browser/download/download_prefs.h" |
15 #include "chrome/browser/download/download_util.h" | 15 #include "chrome/browser/download/download_util.h" |
16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
17 #include "chrome/browser/safe_browsing/download_protection_service.h" | 17 #include "chrome/browser/safe_browsing/download_protection_service.h" |
18 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 private: | 273 private: |
274 // Verifies that |target_path|, |disposition|, |danger_type| and | 274 // Verifies that |target_path|, |disposition|, |danger_type| and |
275 // |intermediate_path| matches the expectations of |test_case|. | 275 // |intermediate_path| matches the expectations of |test_case|. |
276 void DownloadTargetVerifier(const DownloadTestCase* test_case, | 276 void DownloadTargetVerifier(const DownloadTestCase* test_case, |
277 const FilePath& target_path, | 277 const FilePath& target_path, |
278 DownloadItem::TargetDisposition disposition, | 278 DownloadItem::TargetDisposition disposition, |
279 content::DownloadDangerType danger_type, | 279 content::DownloadDangerType danger_type, |
280 const FilePath& intermediate_path); | 280 const FilePath& intermediate_path); |
281 | 281 |
282 TestingPrefService* pref_service_; | 282 TestingPrefService* pref_service_; |
283 ScopedTempDir test_download_dir_; | 283 base::ScopedTempDir test_download_dir_; |
284 content::TestBrowserThread ui_thread_; | 284 content::TestBrowserThread ui_thread_; |
285 content::TestBrowserThread file_thread_; | 285 content::TestBrowserThread file_thread_; |
286 scoped_refptr<content::MockDownloadManager> download_manager_; | 286 scoped_refptr<content::MockDownloadManager> download_manager_; |
287 scoped_refptr<TestChromeDownloadManagerDelegate> delegate_; | 287 scoped_refptr<TestChromeDownloadManagerDelegate> delegate_; |
288 MockWebContentsDelegate web_contents_delegate_; | 288 MockWebContentsDelegate web_contents_delegate_; |
289 }; | 289 }; |
290 | 290 |
291 ChromeDownloadManagerDelegateTest::ChromeDownloadManagerDelegateTest() | 291 ChromeDownloadManagerDelegateTest::ChromeDownloadManagerDelegateTest() |
292 : ChromeRenderViewHostTestHarness(), | 292 : ChromeRenderViewHostTestHarness(), |
293 ui_thread_(content::BrowserThread::UI, &message_loop_), | 293 ui_thread_(content::BrowserThread::UI, &message_loop_), |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 // Run the first test case again. Since the last download path was cleared, | 908 // Run the first test case again. Since the last download path was cleared, |
909 // this test case should behave identically to the first time it was run. | 909 // this test case should behave identically to the first time it was run. |
910 RunTestCases(kLastSavePathTestCases, 1); | 910 RunTestCases(kLastSavePathTestCases, 1); |
911 } | 911 } |
912 | 912 |
913 // TODO(asanka): Add more tests. | 913 // TODO(asanka): Add more tests. |
914 // * Default download path is not writable. | 914 // * Default download path is not writable. |
915 // * Download path doesn't exist. | 915 // * Download path doesn't exist. |
916 // * IsDangerousFile(). | 916 // * IsDangerousFile(). |
917 // * Filename generation. | 917 // * Filename generation. |
OLD | NEW |