| 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 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/download/download_prefs.h" | 22 #include "chrome/browser/download/download_prefs.h" |
| 23 #include "chrome/browser/download/download_util.h" | 23 #include "chrome/browser/download/download_util.h" |
| 24 #include "chrome/browser/prefs/pref_service.h" | 24 #include "chrome/browser/prefs/pref_service.h" |
| 25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/test/base/testing_profile.h" | 26 #include "chrome/test/base/testing_profile.h" |
| 27 #include "content/browser/download/download_buffer.h" | 27 #include "content/browser/download/download_buffer.h" |
| 28 #include "content/browser/download/download_create_info.h" | 28 #include "content/browser/download/download_create_info.h" |
| 29 #include "content/browser/download/download_file_impl.h" | 29 #include "content/browser/download/download_file_impl.h" |
| 30 #include "content/browser/download/download_file_manager.h" | 30 #include "content/browser/download/download_file_manager.h" |
| 31 #include "content/browser/download/download_id_factory.h" | 31 #include "content/browser/download/download_id_factory.h" |
| 32 #include "content/browser/download/download_manager_impl.h" | |
| 33 #include "content/browser/download/download_request_handle.h" | 32 #include "content/browser/download/download_request_handle.h" |
| 34 #include "content/browser/download/download_status_updater.h" | 33 #include "content/browser/download/download_status_updater.h" |
| 35 #include "content/browser/download/interrupt_reasons.h" | 34 #include "content/browser/download/interrupt_reasons.h" |
| 36 #include "content/browser/download/mock_download_file.h" | 35 #include "content/browser/download/mock_download_file.h" |
| 37 #include "content/browser/download/mock_download_manager.h" | 36 #include "content/browser/download/mock_download_manager.h" |
| 38 #include "content/public/browser/download_item.h" | 37 #include "content/public/browser/download_item.h" |
| 38 #include "content/public/browser/download_manager.h" |
| 39 #include "content/test/test_browser_thread.h" | 39 #include "content/test/test_browser_thread.h" |
| 40 #include "grit/generated_resources.h" | 40 #include "grit/generated_resources.h" |
| 41 #include "net/base/io_buffer.h" | 41 #include "net/base/io_buffer.h" |
| 42 #include "testing/gmock/include/gmock/gmock.h" | 42 #include "testing/gmock/include/gmock/gmock.h" |
| 43 #include "testing/gmock_mutant.h" | 43 #include "testing/gmock_mutant.h" |
| 44 #include "testing/gtest/include/gtest/gtest.h" | 44 #include "testing/gtest/include/gtest/gtest.h" |
| 45 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
| 46 #include "ui/base/text/bytes_formatting.h" | 46 #include "ui/base/text/bytes_formatting.h" |
| 47 | 47 |
| 48 #if defined(USE_AURA) && defined(OS_WIN) | 48 #if defined(USE_AURA) && defined(OS_WIN) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 class DownloadManagerTest : public testing::Test { | 160 class DownloadManagerTest : public testing::Test { |
| 161 public: | 161 public: |
| 162 static const char* kTestData; | 162 static const char* kTestData; |
| 163 static const size_t kTestDataLen; | 163 static const size_t kTestDataLen; |
| 164 | 164 |
| 165 DownloadManagerTest() | 165 DownloadManagerTest() |
| 166 : profile_(new TestingProfile()), | 166 : profile_(new TestingProfile()), |
| 167 download_manager_delegate_(new TestDownloadManagerDelegate( | 167 download_manager_delegate_(new TestDownloadManagerDelegate( |
| 168 profile_.get())), | 168 profile_.get())), |
| 169 id_factory_(new DownloadIdFactory(kValidIdDomain)), | 169 id_factory_(new DownloadIdFactory(kValidIdDomain)), |
| 170 download_manager_(new DownloadManagerImpl( | 170 download_manager_(DownloadManager::Create( |
| 171 download_manager_delegate_, | 171 download_manager_delegate_, |
| 172 id_factory_, | 172 id_factory_, |
| 173 &download_status_updater_)), | 173 &download_status_updater_)), |
| 174 ui_thread_(BrowserThread::UI, &message_loop_), | 174 ui_thread_(BrowserThread::UI, &message_loop_), |
| 175 file_thread_(BrowserThread::FILE, &message_loop_), | 175 file_thread_(BrowserThread::FILE, &message_loop_), |
| 176 download_buffer_(new content::DownloadBuffer) { | 176 download_buffer_(new content::DownloadBuffer) { |
| 177 download_manager_->Init(profile_.get()); | 177 download_manager_->Init(profile_.get()); |
| 178 download_manager_delegate_->SetDownloadManager(download_manager_); | 178 download_manager_delegate_->SetDownloadManager(download_manager_); |
| 179 } | 179 } |
| 180 | 180 |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); | 1295 EXPECT_FALSE(observer->hit_state(DownloadItem::REMOVING)); |
| 1296 EXPECT_TRUE(observer->was_updated()); | 1296 EXPECT_TRUE(observer->was_updated()); |
| 1297 EXPECT_FALSE(observer->was_opened()); | 1297 EXPECT_FALSE(observer->was_opened()); |
| 1298 EXPECT_TRUE(download->GetFileExternallyRemoved()); | 1298 EXPECT_TRUE(download->GetFileExternallyRemoved()); |
| 1299 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); | 1299 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); |
| 1300 EXPECT_EQ(download_item_model->GetStatusText(), | 1300 EXPECT_EQ(download_item_model->GetStatusText(), |
| 1301 l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_REMOVED)); | 1301 l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_REMOVED)); |
| 1302 | 1302 |
| 1303 EXPECT_FALSE(file_util::PathExists(new_path)); | 1303 EXPECT_FALSE(file_util::PathExists(new_path)); |
| 1304 } | 1304 } |
| OLD | NEW |