| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #else | 53 #else |
| 54 #define MAYBE_StartDownload StartDownload | 54 #define MAYBE_StartDownload StartDownload |
| 55 #define MAYBE_DownloadOverwriteTest DownloadOverwriteTest | 55 #define MAYBE_DownloadOverwriteTest DownloadOverwriteTest |
| 56 #define MAYBE_DownloadRemoveTest DownloadRemoveTest | 56 #define MAYBE_DownloadRemoveTest DownloadRemoveTest |
| 57 #endif | 57 #endif |
| 58 | 58 |
| 59 using content::BrowserThread; | 59 using content::BrowserThread; |
| 60 using content::DownloadFile; | 60 using content::DownloadFile; |
| 61 using content::DownloadItem; | 61 using content::DownloadItem; |
| 62 using content::DownloadManager; | 62 using content::DownloadManager; |
| 63 using content::WebContents; |
| 63 | 64 |
| 64 namespace { | 65 namespace { |
| 65 | 66 |
| 66 class MockDownloadFileFactory | 67 class MockDownloadFileFactory |
| 67 : public DownloadFileManager::DownloadFileFactory { | 68 : public DownloadFileManager::DownloadFileFactory { |
| 68 public: | 69 public: |
| 69 MockDownloadFileFactory() {} | 70 MockDownloadFileFactory() {} |
| 70 | 71 |
| 71 virtual DownloadFile* CreateFile(DownloadCreateInfo* info, | 72 virtual DownloadFile* CreateFile(DownloadCreateInfo* info, |
| 72 const DownloadRequestHandle& request_handle, | 73 const DownloadRequestHandle& request_handle, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 85 | 86 |
| 86 DownloadId::Domain kValidIdDomain = "valid DownloadId::Domain"; | 87 DownloadId::Domain kValidIdDomain = "valid DownloadId::Domain"; |
| 87 | 88 |
| 88 class TestDownloadManagerDelegate : public ChromeDownloadManagerDelegate { | 89 class TestDownloadManagerDelegate : public ChromeDownloadManagerDelegate { |
| 89 public: | 90 public: |
| 90 explicit TestDownloadManagerDelegate(Profile* profile) | 91 explicit TestDownloadManagerDelegate(Profile* profile) |
| 91 : ChromeDownloadManagerDelegate(profile), | 92 : ChromeDownloadManagerDelegate(profile), |
| 92 mark_content_dangerous_(false) { | 93 mark_content_dangerous_(false) { |
| 93 } | 94 } |
| 94 | 95 |
| 95 virtual void ChooseDownloadPath(TabContents* tab_contents, | 96 virtual void ChooseDownloadPath(WebContents* web_contents, |
| 96 const FilePath& suggested_path, | 97 const FilePath& suggested_path, |
| 97 void* data) OVERRIDE { | 98 void* data) OVERRIDE { |
| 98 if (!expected_suggested_path_.empty()) { | 99 if (!expected_suggested_path_.empty()) { |
| 99 EXPECT_STREQ(expected_suggested_path_.value().c_str(), | 100 EXPECT_STREQ(expected_suggested_path_.value().c_str(), |
| 100 suggested_path.value().c_str()); | 101 suggested_path.value().c_str()); |
| 101 } | 102 } |
| 102 if (file_selection_response_.empty()) { | 103 if (file_selection_response_.empty()) { |
| 103 BrowserThread::PostTask( | 104 BrowserThread::PostTask( |
| 104 BrowserThread::UI, FROM_HERE, | 105 BrowserThread::UI, FROM_HERE, |
| 105 base::Bind(&DownloadManager::FileSelectionCanceled, | 106 base::Bind(&DownloadManager::FileSelectionCanceled, |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); | 1295 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); |
| 1295 EXPECT_TRUE(observer->was_updated()); | 1296 EXPECT_TRUE(observer->was_updated()); |
| 1296 EXPECT_FALSE(observer->was_opened()); | 1297 EXPECT_FALSE(observer->was_opened()); |
| 1297 EXPECT_TRUE(download->GetFileExternallyRemoved()); | 1298 EXPECT_TRUE(download->GetFileExternallyRemoved()); |
| 1298 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); | 1299 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); |
| 1299 EXPECT_EQ(download_item_model->GetStatusText(), | 1300 EXPECT_EQ(download_item_model->GetStatusText(), |
| 1300 l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_REMOVED)); | 1301 l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_REMOVED)); |
| 1301 | 1302 |
| 1302 EXPECT_FALSE(file_util::PathExists(new_path)); | 1303 EXPECT_FALSE(file_util::PathExists(new_path)); |
| 1303 } | 1304 } |
| OLD | NEW |