| 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/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/value_conversions.h" | 10 #include "base/value_conversions.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 scoped_refptr<content::MockDownloadManager> download_manager_; | 252 scoped_refptr<content::MockDownloadManager> download_manager_; |
| 253 scoped_refptr<TestChromeDownloadManagerDelegate> delegate_; | 253 scoped_refptr<TestChromeDownloadManagerDelegate> delegate_; |
| 254 }; | 254 }; |
| 255 | 255 |
| 256 ChromeDownloadManagerDelegateTest::ChromeDownloadManagerDelegateTest() | 256 ChromeDownloadManagerDelegateTest::ChromeDownloadManagerDelegateTest() |
| 257 : clean_marker_files_(true), | 257 : clean_marker_files_(true), |
| 258 ui_thread_(content::BrowserThread::UI, &message_loop_), | 258 ui_thread_(content::BrowserThread::UI, &message_loop_), |
| 259 file_thread_(content::BrowserThread::FILE, &message_loop_), | 259 file_thread_(content::BrowserThread::FILE, &message_loop_), |
| 260 download_manager_(new content::MockDownloadManager), | 260 download_manager_(new content::MockDownloadManager), |
| 261 delegate_(new TestChromeDownloadManagerDelegate(&profile_)) { | 261 delegate_(new TestChromeDownloadManagerDelegate(&profile_)) { |
| 262 delegate_->SetDownloadManager(download_manager_.get()); | 262 download_manager_->SetDownloadManagerDelegate(delegate_.get()); |
| 263 pref_service_ = profile_.GetTestingPrefService(); | 263 pref_service_ = profile_.GetTestingPrefService(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void ChromeDownloadManagerDelegateTest::SetUp() { | 266 void ChromeDownloadManagerDelegateTest::SetUp() { |
| 267 ASSERT_TRUE(test_download_dir_.CreateUniqueTempDir()); | 267 ASSERT_TRUE(test_download_dir_.CreateUniqueTempDir()); |
| 268 SetDefaultDownloadPath(test_download_dir_.path()); | 268 SetDefaultDownloadPath(test_download_dir_.path()); |
| 269 } | 269 } |
| 270 | 270 |
| 271 void ChromeDownloadManagerDelegateTest::VerifyAndClearExpectations() { | 271 void ChromeDownloadManagerDelegateTest::VerifyAndClearExpectations() { |
| 272 ::testing::Mock::VerifyAndClearExpectations(delegate_); | 272 ::testing::Mock::VerifyAndClearExpectations(delegate_); |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 set_clean_marker_files(false); | 1021 set_clean_marker_files(false); |
| 1022 for (unsigned i = 0; i < arraysize(kConflictingDownloadsTestCases); ++i) | 1022 for (unsigned i = 0; i < arraysize(kConflictingDownloadsTestCases); ++i) |
| 1023 RunTestCase(kConflictingDownloadsTestCases[i], i); | 1023 RunTestCase(kConflictingDownloadsTestCases[i], i); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 // TODO(asanka): Add more tests. | 1026 // TODO(asanka): Add more tests. |
| 1027 // * Default download path is not writable. | 1027 // * Default download path is not writable. |
| 1028 // * Download path doesn't exist. | 1028 // * Download path doesn't exist. |
| 1029 // * IsDangerousFile(). | 1029 // * IsDangerousFile(). |
| 1030 // * Filename generation. | 1030 // * Filename generation. |
| OLD | NEW |